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