How to open a text file in a textbox
Firstly, to start off, open up Visual Basic 6.0.
When you've done that, it should prompt you with a dialog box asking you what type of project you want to make. Choose Standard EXE and press open.
Once you have done that, you should have something that looks like this:
Now we are going to set up the design of the application. To do this we are going to need one textbox, one command button and one Common Dialog.
So go over to your toolbox (the thing that says "General" and has lots of little icons), and select the command button (the one circled in red in the picture below) and create one of them on the form. Then select the textbox (the one circled in green) and create one of them on the form.


Now we need to insert the common dialog into the toolbox. We do this because it is not there when we start up Visual Basic 6.0. So go ahead and press CONTROL+T. This will bring up the components window. Scrooooolll down until you find something that says, "Microsoft Common Dialog Control 6.0" or similar. Select it and press OK.
You will notice a new icon in your toolbox. Click it and drag it onto your form.

Now we need to name these objects. To do this, click on the textbox and go to the properties dialog (it's on the right hand side).
Go to the name arena. Change the value from Text1 to txt_Input. Do the same for the command button. But instead, call it cmd_open. And the same for the Common Control, except call it CD1.
You can now, also, change the caption of the Command button to Open or whatever you like. Do this the same way we did for the name. Except look for "Caption" instead of Name. You can change the value of the text box as well. Click on it and scroll down to Text on the properties dialog. Change it to whatever you want (it doesn't really matter, it's gonna get changed anyway).
.Now for the fun part, coding!
Double click on the command button. It should come up with code like this:
Private Sub cmd_Open_Click()
End Sub
In the middle of this, insert this code
Dim filename As String
Dim FileLength
CD1.ShowOpen
filename = CD1.filename
Open filename For Input As #1
FileLength = LOF(1)
txt_Input.Text = Input(FileLength, #1)
Close #1
You should now have this code
Private Sub cmd_open_Click()
Dim filename As String
Dim FileLength
CD1.ShowOpen
filename = CD1.filename
Open filename For Input As #1
FileLength = LOF(1)
txt_Input.Text = Input(FileLength, #1)
Close #1
End Sub
What this is telling the application to do is, when you press the command button it is dimming filename as a string. This means we can use the word filename throughout our project and it will recognize it for what the value is. We made the value CD1.Filename. We did this by typing filename = CD1.filename
Then we had CD1.ShowOpen. This is telling the common dialog to show the open dialog.
Then we have
Open filename For Input As #1
FileLength = LOF(1)
txt_Input.Text = Input(FileLength, #1)
Close #1
This is telling the app to open "filename" (remember that it is a string.So it's the name that you selected when the Common idalog showed up) and then it's saying that Filelength is LOF(1).
Then it inputs the text into the textbox using Input(fileLength, #1). #1 is the text inside the text file. Close #1 closes the file. You need to do this with any file you open.
Now press F5. This will run your application. Alternitivly you can press this button (the one highlighted in blue):
You should be able too, now, when your application is running, be able to press one button and it opens an open dialog. You should then choose a file. Then click open. And it should display it in the textbox.
You may want to set the textboxes multiline property to true. To do this, go to the properties dialog again and scroll down to Multiline. Dowble click "False" and it should be set to True.
When you are done with your application, exit out of it and save.