VB中,文本框,一行就是一条记录,当有很多行记录时,如果过滤重复的记录行?谢谢!如果你没有了解我提问的文字,请浏览下面这副图。
http://www.chinadforce.com/attachments/day_041027/vb_1SxTho3iWf60.gif

解决方案 »

  1.   


    http://www.netyi.net/in.asp?id=wuyaxlz
      

  2.   

    首先,如果是一行行的,不如用listbox,然后每次插入记录时,先循环判断是否存在
    dim I as long
    for i=0 to list1.listcount-1
        if list1.list(i)=插入的值 then
              msgbox "记录已经存在'
              exit for
        else
             list1.additem 插入的值
        end if
    next i
      

  3.   

    很简单, 哈哈
    只要判断一下就可以了,先读出所有的内容,然后在这些内容中查找是否有该插入的字符串,找到有的话,就不插入就可以了,前提是插入字符串之后,插入一个 [Enter] 值 :Chr(13)
    举例:(TextBox名:Text1 ; strInsertText 为需要插入的字符串)
    Dim strText As String,strInsertText As String
    strText = Text1.Text
    If Instr(1,strText,Chr(13) & strInsertText & Chr(13),vbTextCompare) = 0 Then
        Text1.Text = strText & strInsertText & Chr(13)
    End If
      

  4.   

    如果是从数据库查找数据,可以在查找的时候就过滤。用select Distinct(字段) from Table .
      

  5.   

    select distinct * into tab from tb
    delete from tb
    insert into tb select * from tab
    drop table tab
      

  6.   

    对,数据库的话用一个 Distinct 就可以了SQL语句:select distinct * from 表名称
      

  7.   

    Private Sub Command1_Click()
    Dim s() As String, t As New Collection, i As Long
    s = Split(Text1.Text, vbCrLf)
    On Error Resume Next
    For i = 0 To UBound(s)
    t.Add s(i), s(i)
    Next
    ReDim s(1 To t.Count)
    For i = 1 To t.Count
    s(i) = t(i)
    Next
    Text1.Text = Join(s, vbCrLf)
    Erase s
    End Sub
      

  8.   

    northwolves的方法可以解决你的问题。 
    没看到?