CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2002
    Location
    United Kingdom
    Posts
    60

    Smile How can I write to a text file...

    Hi,

    I have 4 text boxes on my form:

    A question box called "txtQuestion"

    4 Answer boxes called "Ans1", "Ans2", "Ans3, and "Ans4".

    I also have a 'Save' button. I want to be able to press the save buton and have to question written to a text file on one line, and then the answers one after another on the line below.

    Also, If i repeat the process, I want the nxt lot to go below that and not overwrite the previous.

    Any info on how I can do this, thanks.

    Mark

  2. #2
    Join Date
    Feb 2002
    Location
    Makati City, Philippines
    Posts
    1,054
    I think it's a sinple text (sequential) file that you open for 'Append' everytime you save an entry

    Something like...
    Code:
    Open TxFile For Append As #1
    Print #1, Question
    Print #1, Ans1 & vbtab & Ans2 & vbtab & Ans3 & vbtab & Ans4
    Close#1
    Repeat the process everytime you save.
    Marketing our skills - please participate in the survey and share your insights
    -

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

Featured