tags:

views:

28

answers:

2

I have a simple text reading code for Visual Basic:

Dim fileReader As String
fileReader = My.Computer.FileSystem.ReadAllText("C:\test.txt")
MsgBox(fileReader)

I have used this in the past, but I usually make the text display in a text box. I know this is sort of a "newb" question but I can't remember how to display the text in a textbox. If you guys could help me out that would be great!

+1  A: 

You'd just do:

 textBox1.Text = fileReader

This puts the contents of the string "fileReader" into the TextBox's Text, provided you're doing this from within your Form, and you have a text box on the form named "textBox1".

Also, make sure that your text box is set to be a multi line textbox, if your file has more than a single line within it.

Reed Copsey
+1  A: 
myTextBox.text = fileReader
Diakonia7