又遇到问题了,麻烦大神来看看
我用VB写了一个图片浏览器程序,但遇到了问题,请看一下代码:Option Explicit
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dim r As VbMsgBoxResult
On Error GoTo eh
Dir1.Path = Drive1.Drive
Exit Sub
eh:
If Err.Number = 68 Then
r = MsgBox("请插入磁盘!", vbRetryCancel + vbCritical, "缺少磁盘!")
If r = vbRetry Then
Resume
Else
Drive1.Drive = "c:"
Resume Next
End If
End Sub
Private Sub File1_Click()
If Option2.Value = True Then Exit Sub
Dim picfile As String
If Right(Dir1.Path, 1) = "\" Then
picfile = Dir1.Path + File1.FileName
Else
picfile = Dir1.Path + "\" + File1.FileName
End If
Image1.Picture = LoadPicture(picfile)
Text1.Text = File1.FileName
End Sub
Private Sub File1_DblClick()
If Option1.Value = True Then Exit Sub
Dim picfile As String
If Right(Dir1.Path, 1) = "\" Then
picfile = Dir1.Path + "\" + File1.FileName
End If
Image1.Picture = LoadPicture(picfile)
Text1.Text = File1.FileName
End Sub
程序运行没问题,但如果从 换到 d就会出现 错误,求大神解决。