Hello, I've just started getting into programming and I'm following a few tasks that have been set to learn and understand VB.NET. What i'm working on is a lottery program i've done all the number generation with an array. Now i'm trying to find out how to search that array for lets say less than or equal to 2 you've lost sadly its not working.
Bellow is the code and every time even without anything in the Textbox it doesn't work and just displays you've won the £1,000,000.
ballbox is an array that contains 5 numbers that are generated by another button.
Bellow is the code and every time even without anything in the Textbox it doesn't work and just displays you've won the £1,000,000.
ballbox is an array that contains 5 numbers that are generated by another button.
VB.NET:
Private Sub BTN_Check_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTN_Check.Click
Dim i As Integer = 0
Dim Textbox1 As Integer = 0
Dim found As Integer = 0
i = Textbox1
For Each i In ballbox
found += 1
Next
If found <= 2 Then
MsgBox("You have lost")
ElseIf found = 3 Then
MsgBox("You have won £10")
ElseIf found = 4 Then
MsgBox("You have won £450")
ElseIf found = 5 Then
MsgBox("You have won £5,000")
ElseIf found = 6 Then
MsgBox("You have won £1,000,000")
End If