CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 1999
    Location
    California, USA
    Posts
    40

    How so i save to a file?

    Hey i need some help, i am making this text simple program and, you no the part where the user selects File|Save as, wekk i need the code for the saving. Please help, thanks

    PanasonicSubz

  2. #2
    Guest

    Re: How so i save to a file?

    Right - first you need to open a file for writing:


    fn=FreeFile
    Open Path & FileName for input as #fn




    This code opens a file so that you can write data into it, creating it if it doesn't already exist. And then you put the contents of the text box into the file. Assuming your textbox is called Text1:


    print #fn, Text1.Text




    Then you close the file:


    close #fn




    And that's all there is to it.

    One final word - Path and FileName above are strings. They contain the location you are saving to. Path must end with a "\" or FileName must start with one, but not both. Path and FileName can both be retrieved by using the Common Dialog Save "Path" and "FileName" properties.

    Hope this helps.



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