标题:又遇到问题了,麻烦大神来看看
只看楼主
VB丶小宇
Rank: 3Rank: 3
来 自:河北省石家庄市
等 级:论坛游侠
帖 子:172
专家分:142
注 册:2013-3-11
结帖率:96.77%
已结贴  问题点数:10 回复次数:2 
又遇到问题了,麻烦大神来看看
我用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就会出现
错误,求大神解决。
搜索更多相关主题的帖子: 浏览器 
2013-03-22 19:05
seafish011
Rank: 7Rank: 7Rank: 7
等 级:黑侠
威 望:1
帖 子:167
专家分:694
注 册:2011-11-8
得分:10 
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 if    '在这里加个END IF
End Sub
这个里面少了个END IF
2013-03-22 20:22
VB丶小宇
Rank: 3Rank: 3
来 自:河北省石家庄市
等 级:论坛游侠
帖 子:172
专家分:142
注 册:2013-3-11
得分:0 
回复 2楼 seafish011
非常感谢您的解答,照改后能正常运行,万分感谢。

编程最蛋疼的事:不是编程多么累,而是编完后,一点运行,出现四个字:程序错误。。。
2013-03-22 22:13



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-401601-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.556700 second(s), 9 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved