Results 1 to 2 of 2

Thread: Open/Save

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    In your Ass
    Posts
    1

    Open/Save

    I would like to know how could we load a file and save it as a *.txt file. I made a program more less like Word and i know that we have to make a directory listbox and a file listbox (i already made them ), but i dont know how to save what is in the "giant" textbox on a file, and then load it. Could you teach me how to do that. Oh and another thing is to Save and also Load what is on a listbox.

  2. #2
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    use the code below to load/read a text file.

    VB Code:
    1. Private Sub command1_Click()
    2.     Dim FilePath As String
    3.     Dim Temp As String
    4.     FilePath = "c:\testn\test.txt"
    5.     Open FilePath For Input As #1
    6.    
    7.     'Opens the file given by the user.
    8.     Do Until EOF(1)
    9.     'Does this loop until End Of File(EOF) for file number 1.
    10.         Line Input #1, Temp
    11.         'Read one line and puts it into the varible Temp
    12.         Text1.Text = Text1.Text & vbCrLf & Temp 'adds the existing text + the next line
    13.         'Adds the read line into Text1.
    14.         MsgBox "End of file reached!"
    15.     Loop
    16.    
    17.     Close #1
    18. End Sub
    Last edited by scr0p; Nov 22nd, 2002 at 11:15 PM.
    asdf

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