|
-
July 11th, 2000, 12:59 PM
#1
Help in VB6
hi,
I need to save my final data in a text file,but i cant seem to do it.And also,I cant seem to figure out how to retrieve data from the text box (i.e.,using the open box control).
It would be great if u guys can help me out on this.
Thanks
-
July 11th, 2000, 01:25 PM
#2
Re: Help in VB6
Here's a simple and quick explanation for saving data to a file:
Dim filename as string
Dim strData as string
'get data from a text box and input into variable
'to write to the text file
strData = Text1.text 'gets the text from a text
'box named Text1
filename = "mydoc.txt" 'any valid filename
Open filename for input as #1
LineInput#1, strData
Close #1
That code will write one line to your text file. If you wish to write more lines at once simply use a Do Loop to write all the lines you wish to write.
Open filename for input as #1
Do [condition]
strData = "new value" 'some new value
'you could use an array on this line that holds
'all the lines of text you want to hold e.g.
'strData = strArray(iCounter) and create an
'incrementing iCounter (integer) inside the loop
input#1, strData
Loop
Close #1
Hope this helps you out.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|