Solved

Easy question on text box

Posted on 1999-01-08
5
146 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
Comment Utility
Let me make a small code for you.
0
 
LVL 3

Expert Comment

by:a111a111a111
Comment Utility
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
Comment Utility
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
Comment Utility
OH yeah it has to be in VB3 format i cant use a higher version.
0
 
LVL 3

Expert Comment

by:a111a111a111
Comment Utility
If you have a problem with the:

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

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 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

8 Experts available now in Live!

Get 1:1 Help Now