Results 1 to 2 of 2

Thread: saving and loading from a text file

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    11

    saving and loading from a text file

    i need to be able to save 8 text boxes to a txt file and then be able to load the data back into their original boxes when the form is loaded.
    any help is greatly apreciated!

  2. #2
    Addicted Member
    Join Date
    Sep 2002
    Location
    Guwahati, Assam, India
    Posts
    131
    VB Code:
    1. Private Sub cmdSave_Click()
    2.    Open Myfile.txt For Output As #1
    3.       Print #1, Text1.Text
    4.       Print #1, Text2.Text
    5.       Print #1, Text3.Text
    6.       Print #1, Text4.Text
    7.       Print #1, Text5.Text
    8.       Print #1, Text6.Text
    9.       Print #1, Text7.Text
    10.       Print #1, Text8.Text
    11.    Close #1
    12. End Sub
    13.  
    14. Private Sub Form_Load()
    15.    Dim temp As string
    16.    Open Myfile.txt For Input As #1
    17.       Input #1, temp
    18.       Text1.Text = temp
    19.       Input #1, temp
    20.       Text2.Text = temp
    21.       Input #1, temp
    22.       Text3.Text = temp
    23.       Input #1, temp
    24.       Text4.Text = temp
    25.       Input #1, temp
    26.       Text5.Text = temp
    27.       Input #1, temp
    28.       Text6.Text = temp
    29.       Input #1, temp
    30.       Text7.Text = temp
    31.       Input #1, temp
    32.       Text8.Text = temp
    33.    Close #1
    34. End Sub
    I am new to VB...

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