FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


VB 6.0 need help loading a .txt file into a text box





andy26
im using this code to save to a .txt file
Code:
Public Sub ftpthing()
Path = App.Path & ("/urldat")
Title = urldat
Text = Form5.txtftpu.Text

Open Path & Title & ".txt" For Output As #1
    Print #1, Text
Close #1
End Sub


but i now need a code to load the .txt back into a text box.
i need some help on how to do so iv tried a few things and have failed.
thanks in advance
Trickster
Okay this should pretty much work for you:

Code:
Public Sub load_ftpthing()
Dim Path, Title, Text As String

Path = App.Path & ("/urldat")
Title = urldat

Open Path & Title & ".txt" For Input As #1 'Opens your desired textfile.
    Do While Not EOF(1) 'Runs a loop for each line until end of file is reached.
        Line Input #1, Text 'Each line is set to the string variable "Text".
            TXT_Textbox.Text = TXT_Textbox.Text & Text & Chr(13) & Chr(10) 'Adds each line from the "Text" variable to the textbox, and moves to next line.
    Loop
Close #1
End Sub
andy26
thanks
Trickster
You're welcome Wink
gibbo
I use this code
Code:
Public Sub ftpthing()
Dim usr As String
Open App.Path & "\userdat.txt" For Input As #1
usr = Input(LOF(1), 1)
Close #1
Form5.ftpthing.Text = usr
Related topics
Create a txt file
VisualBasic 6.0 Help
.txt file to .php Lined to tables
Visual basic 6.0 help me with saving code please
Help importing CSV file into MySQL database
load file into div dynamically using html possible
Displaying .txt file on web page
Reading from text file into Flash
VB Help for those who need small pointers in Visual Basic
VB 6.0 saving multipul .txt from a text box need help
Saving a .txt file to a ftp using vb6. i need help please
how to check if a file exists. please help (visual basics 6)
How can you get cpu usage to display in VB 6.0?
is it possible to get a html text box to load a .txt file?
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.