Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Easy question on text box

Posted on 1999-01-08
5
184 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

856 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