a = Str(100000 * Rnd() Mod 52 + 1)For i = 1 To 52
    if  a<>list1.
List1.AddItem a就是说,列表框中已经有的数据不要再出现,请大侠指点

解决方案 »

  1.   

    a = Str(100000 * Rnd() Mod 52 + 1) dim blnHave as boolean
    blnhave=falseFor i = 1 To 52 
        if  a <>list1. then
             blnhave=true
             exit for
        end if
    next iif not blnhave then
         List1.AddItem a 
    end if
      

  2.   

            Dim s As Integer
            s = 0
              For i = 0 To List1.ListCount
                If a = List1.List(i) Then
                    s = 1
                    Exit For
                End If
              Next
            If s = 0 Then
                List1.AddItem a
            End If
      

  3.   

    For i = 0 To List1.ListCount -1