Results 1 to 3 of 3

Thread: multiple txtboxes saving to file

  1. #1
    Chavez
    Guest

    Post multiple txtboxes saving to file

    How can I do this.
    I have 4 text boxes side by side, and I want to save all of their
    contents to a file. But I want the file's contents to reflect how
    they look in the text boxes side by side. What I mean is I can't
    save the first text box and then the second, third, etc., but I need
    to get line #1 from textbox1, textbox2, textbox3, & textbox4 and
    that will be the first line of the text file......

    How can I do this in a loop??

    Thanks for any help.

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    VB Code:
    1. Print #1, Text1.Text & " " & Text2.Text & " " & Text3.Text etc etc...

  3. #3
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    if you're saving settings, you can also use the registry.

    here's some code

    VB Code:
    1. Private Sub Command1_Click()
    2.         Call WriteToFile (text1.Text & " " & text2.text & " " & text3.text & _
    3.                  " " & text4.text & vbcrlf, app.path & "\filename.txt")
    4. End Sub
    5.  
    6.  
    7. 'write to file sub
    8. Public Sub WriteToFile(strLineToWrite As String, strFileName As String)
    9.     'write log file will make dir if it doesnt exists
    10.     Dim FileNum As Integer 'Windows File Number Reference
    11.  
    12.     Open strPath & "\" & strFileName For Append As FileNum
    13. 'If it is there then append data to end of file
    14.         Print #FileNum, strLineToWrite
    15.     Close FileNum
    16.    
    17. Exit Sub
    18. End Sub
    Last edited by nabeels786; Nov 12th, 2001 at 08:27 PM.
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width