Link to home
Start Free TrialLog in
Avatar of centaurs
centaurs

asked on

Easy question on text box

Im new to vb so how do you open a text file into a text box.
im mean like put the text of file stuff.txt in to text1.text

I need the code for Visual Basic 3
Thanks
ASKER CERTIFIED SOLUTION
Avatar of a111a111a111
a111a111a111

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of a111a111a111
a111a111a111

Sub Command1_Click ()
Dim FName, allLine, GetLine, NL' Declare variables.
    NL = Chr(13) & Chr(10)
        FName = "c:\autoexec.bat"
        Open FName For Input As #1   ' Open file.
    Do While Not EOF(1) ' Check for end of file.
        Input #1, GetLine
        allLine = allLine & GetLine & NL
    Loop
    text1.Text = allLine  ' Place the text in the textbox.
    Close #1  ' Close the file
    End Sub

' Note: Make sure that your textbox properties have MultiLine = true

'If you need any more help here let me know.

'also you can email to me at :

'shayplace@hotmail.com
Avatar of centaurs

ASKER

That worked great thanks. Hey by any chance do you know how to send and receve packets with data to a remote machine like:

localhost send "HI"  remotehost (124.768.94.56)then in a text box the remote host will see HI.

Got any ideas if you can help me on this one ill raise the points to 100.

Thanks
OH yeah it has to be in VB3 format i cant use a higher version.
If you have a problem with the:

Input #1, GetLine
change it to :
Line Input #1, GetLine