Private Const LB_FINDSTRINGEXACT = &H1A2 '在 ListBox 中精确查找
Private Sub Command1_Click()
Dim strLine As String
Dim i As Long
List1.Clear
Open "c:\test1.txt" For Input As #1
Do Until EOF(1)
Line Input #1, strLine
strLine = Trim(strLine)
If -1 = SendMessagebyString(List1.hWND, LB_FINDSTRINGEXACT, -1, strLine) Then List1.AddItem strLine
Loop
Close #1
Open "c:\test2.txt" For Output As #2
For i = 0 To List1.ListCount - 1
Print #2, List1.List(i)
Next i
Close #2
MsgBox "ok"
End Sub
Private Sub Form_Load()
Dim i As Long
Open "c:\test1.txt" For Output As #1
For i = 1 To 10000
Print #1, "1;2;3;4;5;6;7;8;9;10;11;12 "
Print #1, "1;2;3;4;5;6;7;asda8;9;10;11;12a"
Print #1, "1;2;3;4;5;6;7;8;9;10;11;12"
Print #1, "1;2;3;4;5;6;7;8;9;asdasd10;11;12b"
Next i
Close #1
End Sub
快的原因可能有两个,一是重复记录太多,在 List 中备份的很少。二是我的机器不算太慢。