Hi Cor -
Thanks for writing.
The book has 'finished code' for all the problems.
Here is the 'finished code' supposedly supplied when you hit Insert
Snippet > Processing Drives, Folders and Files > Write Text to a File :
=-=-=-=-
Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object,
ByVal e As _
System.ComponentModel.CancelEventArgs) Handles
SaveFileDialog1.FileOk
Try
' The property FileName from the first argument in
WriteAllText refers to
' the FileName selected by the user in the SaveFileDialog1
' Then we are passing the content of each TextBox and
concatenating the
' Carriage Return-Line Feed constant
' The last parameter indicated if we should append to a file
if it
' exists. False will not and therefore recreate the file
each time.
' In order to add the content of the first box we need to
put true for
' the 2d and 3rd write otherwise only the last one would be
there
' if they were both true.
My.Computer.FileSystem.WriteAllText(Me.SaveFileDialog1.FileName, _
Me.tbMessage.Text & vbCrLf, False)
My.Computer.FileSystem.WriteAllText(Me.SaveFileDialog1.FileName, _
Me.TextBox2.Text & vbCrLf, True)
My.Computer.FileSystem.WriteAllText(Me.SaveFileDialog1.FileName, _
Me.TextBox3.Text & vbCrLf, True)
Catch fileException As Exception
Throw fileException
End Try
End Sub
=-=-=-=
As for me, this is the code snippet that was pasted when I created the
application
Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object,
ByVal e As System.ComponentModel.CancelEventArgs) Handles
SaveFileDialog1.FileOk
My.Computer.FileSystem.WriteAllText("C:\Test.txt", "Text", True)
End Sub
=-=-=-=
What the application does is save the contents of 3 textboxes to a file,
so you can see it.
Something is weird. I hope you can help me straighten this out!
Thanks for helping,
Joy