i no the code i hope it helps
Code: Select all
'dim the open as the file dialog
'u can use SaveFileDialog to save too!
Dim Open as New OpenFileDialog
'file types to show
Open.Filter = "Filetype (*.file)|*.file|All files (*.*)|*.*"
Open.Title = "Dialog Title Here"
Open.CheckFileExists = True
Open.ShowDialog(Me)
ok, now if u want it to read a text file, do this:
Code: Select all
Dim myStreamReader As System.IO.StreamReader
Dim output as New String = ""
Try
Open.OpenFile()
myStreamReader = System.IO.File.OpenText(Open.FileName)
'replace output with w/e u want it to load the text into
output = myStreamReader.ReadToEnd()
'this will catch exceptions and display a message box error
Catch ex As Exception
MsgBox("Your error message here")
End Try
so ur total code would be:
Code: Select all
'dim the open as the file dialog
'u can use SaveFileDialog to save too!
Dim Open as New OpenFileDialog
'file types to show
Open.Filter = "Filetype (*.file)|*.file|All files (*.*)|*.*"
Open.Title = "Dialog Title Here"
Open.CheckFileExists = True
Open.ShowDialog(Me)
Dim myStreamReader As System.IO.StreamReader
Dim output as New String = ""
Try
Open.OpenFile()
myStreamReader = System.IO.File.OpenText(Open.FileName)
'replace output with w/e u want it to load the text into
output = myStreamReader.ReadToEnd()
'this will catch exceptions and display a message box error
Catch ex As Exception
MsgBox("Your error message here")
End Try
ok the code would load up the open dialog, the users selects a file, the text is loaded into the string 'output' and then the code ends. ok u want it to write it directly to a textbox named 'Textbox1'? ok fine heres the code.
Code: Select all
'dim the open as the file dialog
'u can use SaveFileDialog to save too!
Dim Open as New OpenFileDialog
'file types to show
Open.Filter = "Filetype (*.file)|*.file|All files (*.*)|*.*"
Open.Title = "Dialog Title Here"
Open.CheckFileExists = True
Open.ShowDialog(Me)
Dim myStreamReader As System.IO.StreamReader
Try
Open.OpenFile()
myStreamReader = System.IO.File.OpenText(Open.FileName)
'replace output with w/e u want it to load the text into
TextBox1.Text = myStreamReader.ReadToEnd()
'this will catch exceptions and display a message box error
Catch ex As Exception
MsgBox("Your error message here")
End Try
if i messed up or u need more help or u want help in another thing, IM me on AIM, my sn is: PlasmaGrunt
sorry tho i only program vb2005
hope it helps!