Counting the mines

xasbel

New member
Joined
Sep 30, 2011
Messages
3
Programming Experience
Beginner
Hello, so I'm kinda new to Visual Basic. I have a problem and I don't know how to solve. Here's a picture.
problem.JPG

As you see, I've generated a field containing a set of 0's and 1's in the Listbox. What my problem is, counting the "11" in the items. The #'s said in the label is the mines which is the number of 11's that the listbox contains. Can someone help me with the code? It will help me a lot. Also, if i press Generate, the 0's and 1's are randomized so it will count again. Any help?
 
Did you do it?


Why don't you use a 2d array, then loop through the array and count the 1's ? (just a quick simple way, there is most likely otherways to acheive this using a custom class and array list).
 
Well, not yet. It was postponed and was moved to an another day. Can you specify what to do? Like the code. I'll try to input it. Thanks :D
 
Do you know how to do a loop?

Loop round the amount of 'rows' and within each loop put another loop for the amount of columns.


for example...

for x = 0 to 10

for y= 0 to 10
next

next


if you were to output the values, you would get... x=0 , y=0,1,2,3,4,5,6,7,8,9,10 then x=1 , y=0,1,2,3,4,5,6,7,8,9,10

?
 
Back
Top