My overall goal is to have text be displayed in a label based on the random image that is displayed. I would then like to have the user pick a button that has an IF Then statement analyze the text and say whether the user picked the right button based on what the random image is. Ive been unsuccessful at creating the If Then statement. Everything up to that point is working.
Option Explicit On
Public Class Form1
Private imgList As New Dictionary(Of String, Bitmap)
Private number As String
Private ran As New Random
Private i As Integer
Private o As Integer
Private r As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
imgList.Add("Ace1", My.Resources.Resource1.ace1)
imgList.Add("Ace2", My.Resources.Resource1.ace2)
imgList.Add("Ace3", My.Resources.Resource1.ace3)
imgList.Add("Ace4", My.Resources.Resource1.ace4)
imgList.Add("Two1", My.Resources.Resource1.two1)
imgList.Add("Two4", My.Resources.Resource1.two4)
imgList.Add("Three1", My.Resources.Resource1.three1)
imgList.Add("Three2", My.Resources.Resource1.three2)
imgList.Add("Three3", My.Resources.Resource1.three3)
imgList.Add("Three4", My.Resources.Resource1.three4)
imgList.Add("Four1", My.Resources.Resource1.four1)
imgList.Add("Four2", My.Resources.Resource1.four2)
imgList.Add("Four3", My.Resources.Resource1.four3)
imgList.Add("Four4", My.Resources.Resource1.four4)
imgList.Add("King1", My.Resources.Resource1.king1)
imgList.Add("King2", My.Resources.Resource1.king2)
imgList.Add("King3", My.Resources.Resource1.king3)
imgList.Add("King4", My.Resources.Resource1.king4)
hitButton.Visible = False
stayButton.Visible = False
doubleButton.Visible = False
splitButton.Visible = False
End Sub
Private Sub dealButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dealButton.Click
Call RandomInt()
playerPictureBox1.Image = imgList.Values(i)
playerPictureBox2.Image = imgList.Values(o)
dealerPictureBox1.Image = imgList.Values(r)
hitButton.Visible = True
stayButton.Visible = True
doubleButton.Visible = True
splitButton.Visible = True
If imgList.Count <> 0 Then
Label1.Text = imgList.Keys(i).ToString
End If
End Sub
Private Sub hitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hitButton.Click
End Sub
Private Sub RandomInt()
ran = New Random
i = ran.Next(0, imgList.Count)
o = ran.Next(0, imgList.Count)
r = ran.Next(0, imgList.Count)
End Sub
End Class
Option Explicit On
Public Class Form1
Private imgList As New Dictionary(Of String, Bitmap)
Private number As String
Private ran As New Random
Private i As Integer
Private o As Integer
Private r As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
imgList.Add("Ace1", My.Resources.Resource1.ace1)
imgList.Add("Ace2", My.Resources.Resource1.ace2)
imgList.Add("Ace3", My.Resources.Resource1.ace3)
imgList.Add("Ace4", My.Resources.Resource1.ace4)
imgList.Add("Two1", My.Resources.Resource1.two1)
imgList.Add("Two4", My.Resources.Resource1.two4)
imgList.Add("Three1", My.Resources.Resource1.three1)
imgList.Add("Three2", My.Resources.Resource1.three2)
imgList.Add("Three3", My.Resources.Resource1.three3)
imgList.Add("Three4", My.Resources.Resource1.three4)
imgList.Add("Four1", My.Resources.Resource1.four1)
imgList.Add("Four2", My.Resources.Resource1.four2)
imgList.Add("Four3", My.Resources.Resource1.four3)
imgList.Add("Four4", My.Resources.Resource1.four4)
imgList.Add("King1", My.Resources.Resource1.king1)
imgList.Add("King2", My.Resources.Resource1.king2)
imgList.Add("King3", My.Resources.Resource1.king3)
imgList.Add("King4", My.Resources.Resource1.king4)
hitButton.Visible = False
stayButton.Visible = False
doubleButton.Visible = False
splitButton.Visible = False
End Sub
Private Sub dealButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dealButton.Click
Call RandomInt()
playerPictureBox1.Image = imgList.Values(i)
playerPictureBox2.Image = imgList.Values(o)
dealerPictureBox1.Image = imgList.Values(r)
hitButton.Visible = True
stayButton.Visible = True
doubleButton.Visible = True
splitButton.Visible = True
If imgList.Count <> 0 Then
Label1.Text = imgList.Keys(i).ToString
End If
End Sub
Private Sub hitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hitButton.Click
End Sub
Private Sub RandomInt()
ran = New Random
i = ran.Next(0, imgList.Count)
o = ran.Next(0, imgList.Count)
r = ran.Next(0, imgList.Count)
End Sub
End Class