如何在filelistbox中显示指定文件夹下同类文件呢???请指点
如题,下面是我写的代码问题是显示不出来好郁闷。。。不知道错在哪里了
请教教我,谢谢
Dim i As String
Dim j As String
Dim x As Long
Dim y As Integer
Dim Z As String
Private Sub Check_Click(Index As Integer)
Dim 后缀(8) As String
后缀(1) = "*.exe"
后缀(2) = "*.txt"
后缀(3) = "*.doc"
后缀(4) = "*.elx"
后缀(5) = "*.jpg"
后缀(6) = "*.htm"
后缀(7) = "*.pdh"
后缀(8) = "*.dll"
For x = 0 To 7
If Check(x).Value = 1 Then
For y = 0 To File1.ListCount - 1
If UCase(Right(File1.List(y), 4)) = 后缀(x + 1) Then
Z = Z & ":" & 后缀(x + 1)
End If
Next y
End If
Next x
Z = Mid(Z, 2)
End Sub
Private Sub Command1_Click()
File1.Pattern = Z
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()
i = File1.List(File1.ListIndex)
If UCase(Right(i, 4)) = ".TXT" Then
Open (File1.Path & "\" & i) For Input As #1
Do While Not EOF(1)
Line Input #1, j
j = Text & j & vbCrLf
Loop
Close #1
j = Replace(j, ".a:", ".speed")
j = Replace(j, ".b:", ".high")
j = Replace(j, ".c:", ".weigth")
j = Replace(j, "*", vbCrLf & "")
End If
RichTextBox1.Text = j
End Sub
Private Sub Form_Load()
File1.Path = Dir1.Path
Dir1.Path = Drive1.Drive
Drive1.Drive = "d:"
Dir1.Path = "E:\mengyuan"
End Sub