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:
Private Sub cmdExit_Click() 'End the program End End Sub Private Sub cmdOpen_Click() Dim fs As New FileSystemObject Dim ts As TextStream Set ts = fs.OpenTextFile("C:\", txtName.Text, ".Txt") MsgBox ts.ReadLine ts.Close End Sub Private Sub cmdSave_Click() Dim fs As New FileSystemObject Dim ts As TextStream Set ts = fs.CreateTextFile("C:/", txtName.Text, ".txt") ts.WriteLine "Did this save me" ts.Close End Sub




Reply With Quote