Despite some amount of searching, I've spent hours trying to get this right, but I'm failing horribly: Any help would be great, because it sounds so easy!
I have a form with some Textboxes on it.
txtLegal
txtPhone
txtFax
I want to be able to save the contents of these textboxes to a .txt file in the fashion:
legal = this is the legal transcript
phone = 001433 483838
fax = 001433 232322
...etc
I've been fiddling around for hours with Streamwriter, but I'm either getting an empty text file or a file called "1" with the info I need in it.
Heck, I'm lost. :-( Here's how far I have got....
Any help always appreciated!
I have a form with some Textboxes on it.
txtLegal
txtPhone
txtFax
I want to be able to save the contents of these textboxes to a .txt file in the fashion:
legal = this is the legal transcript
phone = 001433 483838
fax = 001433 232322
...etc
I've been fiddling around for hours with Streamwriter, but I'm either getting an empty text file or a file called "1" with the info I need in it.
Heck, I'm lost. :-( Here's how far I have got....
VB.NET:
Private Sub butExport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butExport.Click
'Dialog to Save
Dim legal As String
Dim phone As String
Dim fax As String
Dim gfx As String
Dim url As String
Dim FileName As String
Dim sw As System.IO.StreamWriter
legal = Me.legal.Text
phone = Me.phone.Text
fax = Me.fax.Text
gfx = Me.gfx.Text
url = Me.url.Text
With SaveFileDialog1
.Filter = "Text files (*.txt)|*.txt|" & "All files|*.*"
If .ShowDialog() = Windows.Forms.DialogResult.OK Then
FileName = SaveFileDialog1.FileName
sw.Write("legal =" & legal)
sw.Write("phone =" & phone)
sw.Write("fax =" & fax)
sw.Write("gfx =" & gfx)
sw.Write("url =" & url)
sw.Close()
End If
End With
Me.Close()
frmEntry.Show()
End Sub
End Class
Any help always appreciated!