943,645 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 1354
  • VB.NET RSS
Feb 2nd, 2009
0

Vb dot net Array loop?

Expand Post »
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;

VB.NET Syntax (Toggle Plain Text)
  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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
asif786 is offline Offline
19 posts
since Dec 2008
Feb 5th, 2009
0

Re: Vb dot net Array loop?

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)
Reputation Points: 69
Solved Threads: 19
Junior Poster
samir_ibrahim is offline Offline
155 posts
since Sep 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: new to vb.net
Next Thread in VB.NET Forum Timeline: deployment





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC