I want to open a file and read everything in it and put that data in a string variable...anyone know how to do this?
Printable View
I want to open a file and read everything in it and put that data in a string variable...anyone know how to do this?
VB Code:
Dim strText as String Open "C:\Temp\test.txt" for Input as #1 strText = Input(LOF(1), 1) msgbox "File contents: " & vbcrlf & strText Close #1
All in one variable??? :rolleyes:
Well you could try this:
Put a RichTextBox on the form.
Dim hugestring as string
RichTextBox.Loadfile("yourfile.txt",rtfText)
hugestring = RichTextBox.Text