用数组然后到列表框中去找相同的串,找到就remove就可以了

解决方案 »

  1.   

    1.将字符串赋值于一个数组
    2.做一个For i =1 to 数组上限
                For j = 0 to list1.listcount-1
                   if list1.list(j)=数组(i) then
                     list1.removeitem (list1.listindex)
                   end if
                next j
            next i 
                    
      

  2.   

    你试试::Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd _
    As Long, ByVal Msg As Long, wParam As Any, lParam As Any) As Long
    Public Const LB_GETCOUNT = &H18B
    Public Const LB_GETTEXT = &H189
    Public Const LB_GETTEXTLEN = &H18APrivate Sub Command1_Click()
    Dim count As Long       ' number of items in the list box
    Dim s2l As Long         ' index of the second-to-last item
    Dim itemtext As String  ' text of that item
    Dim textlen As Long     ' length of the item text

    count = SendMessage(List1.hWnd, LB_GETCOUNT, ByVal CLng(0), ByVal CLng(0))
    For I= 1 To Count-1
        textlen = SendMessage(List1.hWnd, LB_GETTEXTLEN, ByVal Cln(I), ByVal CLng(0))
        itemtext = Space(textlen) & vbNullChar
        textlen = SendMessage(List1.hWnd, LB_GETTEXT, ByVal Clng(I), ByVal itemtext)
        itemtext = Left(itemtext, textlen)
        '进行你的判断
        If itemtext = "你需要进行比较的字符串" Then Msgbox "OK,找到啦"
             Next
    End Sub'以上是 在网吧 临时 写的,没有测试 。 思路 谨供 参考 !
      

  3.   

    to sonicdater(发呆呆)
    谢谢你,不过我是新手,还看不懂api,先copy , 等以后能看懂了再研究:))
    to zlight68952()
    请问要怎么把字符串付值与数组?
    dim shuzu(50) as string
    shuzu(1) = text1
    shuzu(2) = text2
    …………
    shuzu(50)= text50
    请问是这样的吗?
      

  4.   

    谢谢sunyuzhe(小老虎)
    来个大虾帮忙看看。
      

  5.   

    每一条字符串 ,与LIST列表里的字符串完全一样吗?如果完全一样岂不是很简单?用数组取出LIST列表里的字符串 ,然后用一个FOR的嵌套来比较
      

  6.   

    字符串写在文本文件中即可。
    可以用文件操作读取。dim i as integeropen FileName for input as #1for i=1 to 50
      input #1, shuzu(i)
    next然后再判断就行了。
      

  7.   

    Private Sub Command7_Click()
    Dim i As Integer
    Dim j As Integer
    Dim zifu As String
    Open "d:\123\yunxing.txt" For Input As #1
    For i = 1 To 50
    Line Input #1, zifu'错误提示:实时错误'62'   输入超出文件尾
    For j = 0 To List1.ListCount - 1
            If List1.List(j) = zifu Then
            List1.RemoveItem (j)
            End If
    Next j
    Next i
    End Sub
    是那里错了?
      

  8.   

    Private Sub Command7_Click()
    Dim i As Integer
    Dim j As Integer
    Dim zifu(60) As String
    Open "d:\123\yunxing.txt" For Input As #1
    For i = 1 To 50
    Line Input #1, zifu(i)'错误提示:实时错误'62'  输入超出文件尾
    For j = 0 To List1.ListCount - 1
            If List1.List(j) = zifu(i) Then
            List1.RemoveItem (j)
            End If
    Next j
    Next i
    End Sub
      

  9.   

    搞定:))Private Sub Command7_Click()
    Dim i As Integer
    Dim j As Integer
    Dim zifu(70) As String
    Open "d:\123\yunxing.txt" For Input As #1
    For i = 1 To 70
    Do Until EOF(1)
    Line Input #1, zifu(i)
    For j = 0 To List1.ListCount - 1
            If List1.List(j) = zifu(i) Then
            List1.RemoveItem (j)
            End If
    Next j
    Loop
    Next i
    Close #1
    End Sub
    谢谢大家帮忙,散分:)