毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> 开发语言 >> 正文

VB如何删除txt文件中重复的行 第2页

更新时间:2012-7-31:  来源:毕业论文
Private Declare Function SendMessagebyString Lib _
"user32" Alias "SendMessageA" (ByVal hWND As Long, _
ByVal wMsg As Long, ByVal wParam As Long, _
ByVal lParam As String) As Long

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 中备份的很少。二是我的机器不算太慢。

上一页  [1] [2] 

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。