Hello sir,
I am using VS2008. I am using save file dialogue box and i am saving the contents of richtextbox which is in the form. So i used the coding below. It only creating the empty file but not the text which i typed in the richtextbox.
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ab
ab = RichTextBox1.Text
Dim myStream As IO.Stream
Dim saveFileDialog1 As New SaveFileDialog()
saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
saveFileDialog1.FilterIndex = 2
saveFileDialog1.RestoreDirectory = True
If saveFileDialog1.ShowDialog() = DialogResult.OK Then
myStream = saveFileDialog1.OpenFile()
If (myStream IsNot Nothing) Then
ab = RichTextBox1.Text
myStream.Close()
End If
End If
End Sub