Killsoft Sugdok

Open and Save txt

Go down

Open and Save txt

Post by giovhz on Sat Mar 23, 2013 1:29 pm

OpenFileDialog1.ShowDialog()
Dim txtfilename As String = OpenFileDialog1.FileName
If System.IO.File.Exists(txtfilename) Then
Dim read As New System.IO.StreamReader(txtfilename)
TextBox1.Text = read.ReadToEnd
read.Close()
End If

'open txt

Dim saveDialog As New SaveFileDialog
Dim fileName As String

saveDialog.Filter = "Text[*.txt*]|*.txt|All Files [*.*]|*.*"

If saveDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
fileName = saveDialog.FileName
Else

MessageBox.Show("user canceled file selections")
Return
End If

Dim fileWriter As New System.IO.StreamWriter(fileName)

Dim textLine As String

textLine = TextBox3.Text
fileWriter.WriteLine(textLine)
fileWriter.Close()

'write and save txt
avatar
giovhz
Newbie
Newbie

Posts : 41
Join date : 2013-03-09

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum