05-26-2011, 12:16 PM
Hello guys,
I need some help.
How would I make this to be able to open a txt file from a webserver and then allow me to edit the file and save it on the webserver?
Here is a screenshot of my form:
I need some help.
How would I make this to be able to open a txt file from a webserver and then allow me to edit the file and save it on the webserver?
Here is a screenshot of my form:
Here is my current code: (Click to View)
Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Open As New OpenFileDialog()
Dim myStreamReader As System.IO.StreamReader
Open.Filter = "Text Files [*.txt*]|*.txt|All Files [*.*]|*.*"
Open.CheckFileExists = True
Open.Title = "Open"
Open.ShowDialog(Me)
Try
Open.OpenFile()
myStreamReader = System.IO.File.OpenText(Open.FileName)
TextBox1.Text = myStreamReader.ReadToEnd()
Catch ex As Exception
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Save As New SaveFileDialog()
Dim myStreamWriter As System.IO.StreamWriter
Save.Filter = "Text Files [*.txt*]|*.txt|All Files [*.*]|*.*"
Save.CheckPathExists = True
Save.Title = "Save"
Save.ShowDialog(Me)
Try
myStreamWriter = System.IO.File.AppendText(Save.FileName)
myStreamWriter.Write(TextBox1.Text)
myStreamWriter.Flush()
Catch ex As Exception
End Try
End Sub
End Class