急!如何VB文件列表框双击文件名在文本框中显示文件内容?

imjj%,ch$PrivateSubForm_Load()Text1.Text=""Drive1.Drive=Left(App.Path,1)Command1.Capt... im jj%, ch$
Private Sub Form_Load()
Text1.Text = ""
Drive1.Drive = Left(App.Path, 1)
Command1.Caption = "打 开"
End Sub

Private Sub drive1_Change()
Dir1.Path = Drive1.Drive
End Sub

Private Sub dir1_Change()
File1.Path = Dir1.Path
End Sub

Private Sub File1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'If File1.ListCount > 0 Then
Text1.Text = IIf(Right(Dir1.Path, 1) = "\", Trim(Dir1.Path) & File1.FileName, Trim(Dir1.Path) & "\" & File1.FileName)
'Shell "explorer " & text1.text, vbNormalFocus
'End If
End Sub

Private Sub Command1_Click()
ch = UCase(getext(Text1.Text))
'只能打开 TXT DOC BMP VBP
If ch = "TXT" Or ch = "DOC" Or ch = "BMP" Or ch = "VBP" Then
Shell "explorer " & Text1.Text, vbNormalFocus
Else
MsgBox "文件类型选择错误", 5, "提示信息"
Text1.Text = ""
End If
End Sub

Function getext(tstr As String) As String
jj = InStrRev(Text1.Text, ".")
If jj > 0 Then getext = UCase(Mid(Text1.Text, jj + 1))
End Function
各位大哥,不好意思,发错问题了,正确问题在以下网页:
http://zhidao.baidu.com/question/100387685.html
展开
 我来答
百度网友f7d95e7
2009-06-07 · TA获得超过1451个赞
知道小有建树答主
回答量:568
采纳率:0%
帮助的人:648万
展开全部
看了你的问题了。。。楼主给我分啊。。。我已经帮你答了啊!!!!
修改file_dblclick如下

Private Sub file_dblclick()
Dim s$
If Right(File1.Path, 1) = "\" Then
fName = File1.Path + File1.FileName
Else
fName = File1.Path + "\" + File1.FileName
End If
Text1.Text = fName
Text1.MultiLine = True
Open fName For input As #1
Do until EOF(1)
Line Input #1, s
Text1.Text = Text1.Text & chr(13) & chr(10) & s
Loop
Close #1
End Sub
尘入蜓孟影食1038
2009-06-06 · TA获得超过3513个赞
知道大有可为答主
回答量:2307
采纳率:87%
帮助的人:1359万
展开全部
你的问题都低是什么啊?
你是写的代码不能正常运行,还是运行结果不是呢需要?到底啊怎么样,你说清白啊
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式