Solved

Easy question on text box

Posted on 1999-01-08
5
162 Views
Last Modified: 2010-05-03
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
0
Comment
Question by:centaurs
  • 3
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
a111a111a111 earned 20 total points
ID: 1455029
Let me make a small code for you.
0
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1455030
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
0
 

Author Comment

by:centaurs
ID: 1455031
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
0
 

Author Comment

by:centaurs
ID: 1455032
OH yeah it has to be in VB3 format i cant use a higher version.
0
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1455033
If you have a problem with the:

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now