Good Day to my visitor. This sample codes all about Drivelistbox, Dirlistbox and Filelistbox. In this example you will learn on how to use these 3 basic controls in Visual Basic 6.
First Step: Create new project in Visual Basic 6. Then Input a Controls in Form1.
*label1, filename , Drivelistbox, Dirlistbox, and Filelistbox.
Second Step: Write these following codes.
Private Sub DirListBox_Change()
FileListBox.Path = DirListBox.Path
End Sub
Private Sub FileListBox_Click()
filename.Caption = FileListBox.filename
End Sub
Private Sub DriveListBox_Change()
Dim msg As String
Dim result As String
On Error GoTo Error
DirListBox.Path = DriveListBox.Drive
Exit Sub
Error:msg = "Error: " & Err.Number & ": " & Err.Description
result = MsgBox(msg, vbOKCancel + vbExclamation , "No Data")
If result = vbOK Then
Resume
Else
DriveListBox.Drive = DirListBox.Path
Err.Clear
Exit Sub
End If
End Sub
Monday, June 16, 2008
Subscribe to:
Posts (Atom)