Hello guys and gals of the DaniWeb community, this time I need help in how to save text to a file in the text editing application I created. Well, I tried using the code below but it didn't do the work:
If (RichTextBox1.Text Is Nothing) Then
MessageBox.Show("No text to save!")
Return
End If
If (SaveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
If (System.IO.File.Exists(SaveFileDialog1.FileName)) Then
System.IO.File.Delete(SaveFileDialog1.FileName)
End If
RichTextBox1.Text = (System.IO.File.WriteAllText(SaveFileDialog1.FileName))
End If
And, I really need your help. I've tried almost everything I know. BTW, thanks in advance.