自制了一个小程序,但是里面有一段代码不能理解,求大神赐教!
编写了一个文件和浏览图片相结合的程序。程序如图:
代码如下:
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