Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 31st, 2003, 01:52 PM
Buddy12570 Buddy12570 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 4 Buddy12570 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old December 31st, 2003, 11:39 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
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??

Reply With Quote
  #3  
Old January 1st, 2004, 12:32 AM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,178 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 56 m 45 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
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

Reply With Quote
  #4  
Old January 3rd, 2004, 08:24 PM
robbage robbage is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Perth, Western Australia
Posts: 30 robbage User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via ICQ to robbage
Re: Multiple TextBox's saved to text file

Quote:
Originally posted by Buddy12570
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.


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.

Reply With Quote
  #5  
Old January 3rd, 2004, 08:26 PM
robbage robbage is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Perth, Western Australia
Posts: 30 robbage User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via ICQ to robbage
I think my 'n' key is playing up :-)

Last edited by robbage : January 3rd, 2004 at 08:29 PM.

Reply With Quote
  #6  
Old January 3rd, 2004, 08:41 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,178 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 56 m 45 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Multiple TextBox's saved to text file


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT