|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Multiple TextBox's saved to text file
Hi, Please help.
I am creating a form in VB6 that has three textbox's and a "save" commandBox. I would like the save box to take the information in the three textbox's and place them in a text file (c:\test.text [for discusion purposes]), then clear the fields ready for the next information. Then when save is clicked again it "adds" the information to the text already in the test.txt file. Thanks in advance for any help that may be offered. |
|
#2
|
|||
|
|||
|
What's the format u will save in the file!??For easy to be used,i recommend u to use ms filesystem object..For knowledge about it:THx for Fisherman's advice!Good idea!..I think it should be added to the collection that some knowledge and tools & tutorial link...This is all-sided collection..Do u think about it??
|
|
#3
|
||||
|
||||
|
ok.. here's what I would do in this situation. Dim a variable in your save procedure as a textbox. then use a for each loop in the procedure to loop through all the text boxes in the form and input the values into a string. That way it's dynamic and will change with the number of textboxes on the form. Then you can output that string to a text file
__________________
Fisherman "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein |
|
#4
|
|||
|
|||
|
Re: Multiple TextBox's saved to text file
Quote:
In the save subroutine, open the file like this: open "C:\test.text" for append as #1 then to write to the file as plain text like this: print #1,textbox1.text print #1,textbox2.text print #1,textbox3.text The close the file like this: close #1 the clear the textboxe slike this: textbox1.text="" textbox2.text="" textbox3.text="" The contents of the textboxes will be added to the existing text already in the file, then the textboxes are cleared. Hope this was what you were looking for. |
|
#5
|
|||
|
|||
|
I think my 'n' key is playing up :-)
Last edited by robbage : January 3rd, 2004 at 08:29 PM. |
|
#6
|
||||
|
||||
|
this solution will work. The only reason I suggested the other method is that it is dynamic, and does not require changes if you add more textboxes to the form
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Multiple TextBox's saved to text file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|