![]() |
#2
Artless2013-08-02 21:49
|
程序如图:
只有本站会员才能查看附件,请 登录
代码如下:
Option Explicit
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error Resume Next
Dir1.Path = Drive1.Drive
If Err.Number > 0 Then
MsgBox "设备没有准备好!", vbCritical
End If
End Sub
Private Sub File1_Click()
Dim filename1 As String
If Right(File1.Path, 1) = "\" Then
filename1 = File1.Path & File1.FileName
Else
filename1 = File1.Path & "\" & File1.FileName
End If
Image1.Picture = LoadPicture(filename1)
End Sub
Private Sub Form_Load()
File1.Pattern = "*.gif;*.jpg"
End Sub
其中,以下一段代码表示不很理解,忘大神赐教。
On Error Resume Next
Dir1.Path = Drive1.Drive
If Err.Number > 0 Then
MsgBox "设备没有准备好!", vbCritical