Vb dot net Array loop?

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2008
Posts: 14
Reputation: asif786 is an unknown quantity at this point 
Solved Threads: 0
asif786 asif786 is offline Offline
Newbie Poster

Vb dot net Array loop?

 
0
  #1
Feb 2nd, 2009
I am constructing an array in Vb .NET for a voting simulation program, i want it to store numbers which are being generated these will be unique numbers to each voter and then perform a check to see if the number input by the user matches those stored in the array.

The numbers generated are sequential i.e. 1,2,3 adding 1 each time here is my code;

  1. Private Sub genrandomnum()
  2. counter = counter + 1
  3. count = counter
  4. MsgBox("You're voter number is" & count)
  5. j = 5000
  6. j = j - 1
  7. j = k
  8. count = votearr(k)
  9. End Sub
  10.  
  11. Private Sub btnvoternumber_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnvoternumber.Click
  12. Call genrandomnum()
  13. End Sub
  14.  
  15. Private Sub btnvoternum_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnvoternum.Click
  16.  
  17. voternumcheck = InputBox("Please input voter number")
  18. booFound = False
  19. For k = 5000 To LBound(votearr)
  20.  
  21. If voternumcheck = votearr(k) Then
  22. MsgBox("Value matched at k=" & k)
  23. Else
  24. MsgBox("Value was not found in array")
  25.  
  26. End If
  27. Next k
  28.  
  29. End Sub

As you can see i had a try but it does not work for some reason, thanks a lot
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 148
Reputation: samir_ibrahim is on a distinguished road 
Solved Threads: 16
samir_ibrahim's Avatar
samir_ibrahim samir_ibrahim is offline Offline
Junior Poster

Re: Vb dot net Array loop?

 
0
  #2
Feb 5th, 2009
I will speak on my self when I say I did not understand how your array should work, and I guess that is the reason why you did not got an answer so far, so I suggest the following
- you already post your pseudo-code so we know you had tried
- I suggest posting algorithm of what you want (by words not by code)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC