Can you..
load the contents of a .txt file into a normal text box? IE. NOT a rich text box. Just the normal one or does it have to a a rtb? If you can do it with a normal text box please reply with how. :)
Printable View
Can you..
load the contents of a .txt file into a normal text box? IE. NOT a rich text box. Just the normal one or does it have to a a rtb? If you can do it with a normal text box please reply with how. :)
You can load it into the text box, just not the formatting...
VB Code:
Private Sub Form_Load() Dim CurrentLine As String Open App.Path & "\FILENAME.txt" For Input As #1 Do Until EOF(1) Line Input #1, CurrentLine text1.Text = text1.Text & vbNewLine & CurrentLine Loop Close #1 End Sub
make a text box (text1) and make sure it is mulitline.
Thankyou!!
Here's another method.
Code:Open "Myfile" for Input As #1
Text1.Text = Input(LOF(1),1)
Close #1
Megatron's works as well, however, I think my way is better for experience, as it gives you the basic method of how to read a file and actually use it in various ways... :)
now now, no need to fight over helping me ;)
I use Megatron's method.Quote:
Originally posted by kandieman101
Megatron's works as well, however, I think my way is better for experience, as it gives you the basic method of how to read a file and actually use it in various ways... :)
Well, the method he stated, I used it before he said it here....
Yeah....
Only one thing. I open for binary. It's faster.
:p