Start New Discussion within our Software Development Community

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;

Private Sub genrandomnum()
        counter = counter + 1
        count = counter
        MsgBox("You're voter number is" & count)
        j = 5000
        j = j - 1
        j = k
        count = votearr(k)
    End Sub

    Private Sub btnvoternumber_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnvoternumber.Click
        Call genrandomnum()
    End Sub

    Private Sub btnvoternum_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnvoternum.Click

        voternumcheck = InputBox("Please input voter number")
        booFound = False
        For k = 5000 To LBound(votearr)

            If voternumcheck = votearr(k) Then
                MsgBox("Value matched at k=" & k)
            Else
                MsgBox("Value was not found in array")

            End If
        Next k
     
    End Sub

As you can see i had a try but it does not work for some reason, thanks a lot

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)

This article has been dead for over six months. Start a new discussion instead.