Need Help With ListBox

Posts 1–11 of 11 · Page 1 of 1
Need Help With ListBox
Ok so here is the deal I have a listbox now this list box needs to keep count of 36 numbers and when there's 10 of the same number in this listbox a msgbox pops up now how would I go about that?

Or

same scenario but with only 6 groups of numbers but having them to numbers I can preset example group 1 is 1,4,7,10,13,16,19,22,25,28,31,34 now these numbers will be checked every time I enter another number like 3 so if the hit 10 the msgbox pops up

Thanks Tim
@Gbstar: I don't really get it. Explain it properly please.
Ok so I have a listbox I am adding numbers to it and when there's 10 of the same number in this listbox I would like a msgbox to pop up saying Yay!

hope that's better explained
Code:
        Dim ItemToAdd As String = "Lucky Item"
        Dim Count As Integer = 0
        For i As Integer = 1 To 25
            If Count >= 10 Then
                MsgBox("Yay ! 10 same items in the list.")
                'You can also uncomment the following line so that the counter resets after every 10 items.
                'Count = 0
            End If
            ListBox1.Items.Add(i.ToString())
            Count += 1
        Next
Something like that. Modify it to match what you need exactly.
Thanks hassan ill send it to you once I am done making it = ] you will love it I am sure
Quote Originally Posted by Gbstar View Post
Thanks hassan ill send it to you once I am done making it = ] you will love it I am sure
No problem, and I'll be waiting.
Wait hehe that adds numbers = X hehe i need it to tell me when 10 of the same numbers are in the listbox = [
ok so here ill kinda draw a picture

listbox
1
1 (then mgsbox*yay theres 10 ones in your list box*)
1
1
1
1
1
1
1
1
Quote Originally Posted by Gbstar View Post
Wait hehe that adds numbers = X hehe i need it to tell me when 10 of the same numbers are in the listbox = [
ok so here ill kinda draw a picture

listbox
1
1 (then mgsbox*yay theres 10 ones in your list box*)
1
1
1
1
1
1
1
1
This should work. Guess I misread what you said previously.

Code:
Dim ItemToCheck As String = "Lucky Item"
        Dim Count As Integer = 0
        For Each Item As String In ListBox1.Items
            If Item = ItemToCheck Then
                Count += 1
            End If
            If Count >= 10 Then
                MsgBox("Yay ! Found the item. It was found in the list for " + Count.ToString() + " times.")
                'Count = 0
            End If
        Next
hehe still doesn't work but its okies hassan i still love you = ] thanks for trying ill try another way
Quote Originally Posted by Gbstar View Post
hehe still doesn't work but its okies hassan i still love you = ] thanks for trying ill try another way
What ? It is working for me lol. But
erm I tried its in a timer , button, listbox form load maybe i did something wrong o.o
Posts 1–11 of 11 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us