May 31st, 2012, 01:46 PM
Join Date: May 2012
Time spent in forums: 4 m 26 sec
Reputation Power: 0
Originally Posted by iamtgo3
Well I found the solution on 'Guess I am not aloud to reply with url entered
' Thought if I posted it here other may be able to use it as well.
Dim stFileName As String
Dim openFileDialog1 As New OpenFileDialog
openFileDialog1.InitialDirectory = System.Environment.CurrentDirectory
openFileDialog1.Title = "Open Text File"
openFileDialog1.Filter = "Text files (*.txt)|*.txt"
openFileDialog1.FilterIndex = 1
openFileDialog1.RestoreDirectory = True
If openFileDialog1.ShowDialog() = DialogResult.OK Then
Dim stFilePathAndName As String = openFileDialog1.FileName
Dim MyFile As FileInfo = New FileInfo(stFilePathAndName)
stFileName = MyFile.Name
MessageBox.Show("Your File Info: " & vbCrLf & vbCrLf & _
"File Path and Name: " & stFilePathAndName & vbCrLf & vbCrLf & _
"File Name: " & stFileName, _
"File Info", _
Some minor notes:
1) You need to import "System.IO"
2) You should not create a variable in an "if" statement[/list]