Quick fix, Read text in a text box?
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 remem开发者_JAVA技巧ber how to display the text in a textbox. If you guys could help me out that would be great!
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.
myTextBox.text = fileReader
精彩评论