Results 1 to 16 of 16

Thread: Creat a file (RESOLVED}

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2002
    Posts
    32

    Creat a file (RESOLVED}

    Why doesn't this code work?
    I have a form on it are a txtBox (for input) three cmdButtons (Save ,Open ,Exit) i am trying to create and save a file using what i typed into the txtBox as the name.

    What i eventualy want to do is create a folder using the input from one txtBox and then create files to put in that folder using another txtBox input sequentually numbered 1 to 3.

    I just made this Form up as a test to see what i need to do .
    VB Code:
    1. Private Sub cmdExit_Click()
    2. 'End the program
    3.     End
    4.    
    5. End Sub
    6.  
    7.  
    8. Private Sub cmdOpen_Click()
    9.     Dim fs As New FileSystemObject
    10.     Dim ts As TextStream
    11.      Set ts = fs.OpenTextFile("C:\", txtName.Text, ".Txt")
    12.      MsgBox ts.ReadLine
    13.      ts.Close
    14.      
    15. End Sub
    16.  
    17. Private Sub cmdSave_Click()
    18.     Dim fs As New FileSystemObject
    19.     Dim ts As TextStream
    20.         Set ts = fs.CreateTextFile("C:/", txtName.Text, ".txt")
    21.         ts.WriteLine "Did this save me"
    22.         ts.Close
    23.        
    24. End Sub
    Last edited by mikrow; Nov 30th, 2002 at 11:48 AM.
    Mike Rowland

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