开始转向VB了.低级语言吗?我不知道.我只知道我要学它.
有关Drive 、DIR 、File 控件最基本的操作.以及打开文本文件.
Private Sub Command1_Click()
'打开一文本文件并放入textBox中
'Drive1.Drive = Dir1.Path
'File1.Path = Drive1.Drive
'在打开之前,先清TEXT
Text1.Text = ""
Dim FileNumber
Dim Lstr As String
FileNumber = FreeFile ' 取得未使用的档案代码。
'Open App.Path & "\" & "test.txt" For Input As #FileNumber
Open filepath For Input As #FileNumber
Do While Not EOF(FileNumber)
Line Input #FileNumber, Lstr
Text1.Text = Text1.Text + Lstr + Chr(13) + Chr(10)
Loop
Close #FileNumber
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub File1_DblClick()
' MsgBox Drive1.Drive & "\" & Dir1.Path & "\" & File1.FileName
' 路经及文件名
MsgBox Dir1.Path & "\" & File1.FileName
filepath = Dir1.Path & "\" & File1.FileName
Call Command1_Click
' MsgBox Dir1.Parent
End Sub


浙公网安备 33010602011771号