How to get full file path in visual basic?
1) Make Design look like in figure.
(Note : File path will print on text box)
2) Double click on DriveListBox, and then paste code
Code is:
Private Sub Drive1_Change()
Dir1.Path = Left$(Drive1.Drive, 1) & ":\"
End Sub
3) Double click on DirListBox, and then paste code
Code is:
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
4) Double click on FileListBox, and then paste code
Code is:
Private Sub File1_Click()
'Text1.Text = File1.FileName
Dim file As String
file = "\" & File1.FileName
Text1.Text = Dir1.Path & file
End Sub
Code Window will be:



No comments:
Post a Comment