Computing.Net > Forums > Programming > loading text into a textbox in VB6

loading text into a textbox in VB6

Reply to Message Icon

Original Message
Name: Orion Pax
Date: September 3, 2003 at 19:54:58 Pacific
Subject: loading text into a textbox in VB6
OS: win2k
CPU/Ram: 1.1ghz celeron 384mb
Comment:

Ok I am trying to load text from a file into a multiline text box and it loads all the lines except its loading them all over each other on the first line in the textbox.....therefore only displaying the last line. Is there a position command in VB6 for the textbox?


Report Offensive Message For Removal

Response Number 1
Name: Infinite Recursion
Date: September 3, 2003 at 20:16:03 Pacific
Subject: loading text into a textbox in VB6
Reply: (edit)

You can try...

txtMyText.text = txtMyText.text & lineFromFile

if that doesn't work...

You can include a carriage return and line feed to each line of the file by appending vbCrLf.

Infinite Recursion


Report Offensive Follow Up For Removal

Response Number 2
Name: AlwaysWillingToLearn
Date: September 17, 2003 at 08:42:00 Pacific
Subject: loading text into a textbox in VB6
Reply: (edit)

Write what you need to do is firstly the text box in which you want the data to be stored should be set to multiple line=true

now the following

''''''CODE''''
Dim fso, f
Const ForReading = 1
Set fso = CreateObject
("Scripting.FileSystemObject")
Set f = fso.opentextfile("c:\windows\desktop\a.txt", ForReading)
Text1.Text = f.read(1000000)

please note that the set fso= createobject ("Scipting.filesystemobject") should be all on one line

Email me and let me know if it works please i would appreciate that
Have a nice day.

oh yeah i wasnt ure if you were reading from a text file or a ini file this code only works for .txt files.
should all be one line

the "c:\windows\desktop\a.txt is the path in which the file you want to read in held..



Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: loading text into a textbox in VB6

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software