vb 资源管理器
需要编写一个vb的资源管理器,只能看到txt文件的。选中文件后在text1里显示出文件内容。代码如下。但是有一个错误53.,我不会改。因为等级太低,不能传图。各位大虾,帮...
需要编写一个vb的资源管理器,只能看到txt文件的。选中文件后在text1里显示出文件内容。
代码如下。
但是有一个错误53.,我不会改。
因为等级太低,不能传图。
各位大虾,帮帮忙啊。。。
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub File1_Click()
Dim s$, s1$, a$
Text1.Text = ""
If Right(File1.Path, 1) = "\" Then
Print File1.Path & File1.FileName
Open "File1.Path & File1.FileName" For Input As #1
Do While Not EOF(1)
Line Input #1, s1
s = s & s1 & Chr(13) & Chr(10)
Loop
Text1.Text = s
Close (1)
Else
Print File1.Path & " \ " & File1.FileName
Open "File1.Path & " \ " & File1.FileName" For Input As #1
Do While Not EOF(1)
Line Input #1, s1
s = s & s1 & Chr(13) & Chr(10)
Loop
Text1.Text = s
Close (1)
End If
End Sub
Private Sub Form_Load()
File1.Pattern = "*txt"
End Sub 展开
代码如下。
但是有一个错误53.,我不会改。
因为等级太低,不能传图。
各位大虾,帮帮忙啊。。。
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub File1_Click()
Dim s$, s1$, a$
Text1.Text = ""
If Right(File1.Path, 1) = "\" Then
Print File1.Path & File1.FileName
Open "File1.Path & File1.FileName" For Input As #1
Do While Not EOF(1)
Line Input #1, s1
s = s & s1 & Chr(13) & Chr(10)
Loop
Text1.Text = s
Close (1)
Else
Print File1.Path & " \ " & File1.FileName
Open "File1.Path & " \ " & File1.FileName" For Input As #1
Do While Not EOF(1)
Line Input #1, s1
s = s & s1 & Chr(13) & Chr(10)
Loop
Text1.Text = s
Close (1)
End If
End Sub
Private Sub Form_Load()
File1.Pattern = "*txt"
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_Click()
Dim s$, s1$, a$
Text1.Text = ""
If Right(File1.Path, 1) = "\" Then
Print File1.Path & File1.FileName
Open File1.Path & File1.FileName For Input As #1
Do While Not EOF(1)
Line Input #1, s1
s = s & s1 & Chr(13) & Chr(10)
Loop
Text1.Text = s
Close (1)
Else
Print File1.Path & "\" & File1.FileName
Open File1.Path & "\" & File1.FileName For Input As #1
Do While Not EOF(1)
Line Input #1, s1
s = s & s1 & Chr(13) & Chr(10)
Loop
Text1.Text = s
Close (1)
End If
End Sub
Private Sub Form_Load()
File1.Pattern = "*txt"
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_Click()
Dim s$, s1$, a$
Text1.Text = ""
If Right(File1.Path, 1) = "\" Then
Print File1.Path & File1.FileName
Open File1.Path & File1.FileName For Input As #1
Do While Not EOF(1)
Line Input #1, s1
s = s & s1 & Chr(13) & Chr(10)
Loop
Text1.Text = s
Close (1)
Else
Print File1.Path & "\" & File1.FileName
Open File1.Path & "\" & File1.FileName For Input As #1
Do While Not EOF(1)
Line Input #1, s1
s = s & s1 & Chr(13) & Chr(10)
Loop
Text1.Text = s
Close (1)
End If
End Sub
Private Sub Form_Load()
File1.Pattern = "*txt"
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询