Before starting please note I am a complete novice so most of my codes will probably be messy and overcomplicated . I am trying to create a program where when you enter the correct series of digits (In this case 4 digits ranging from 1-12) a picture would appear. The problem is that though it is working for when the correct combination of digits is used, there are also a few occasions when the pictures appear even though the combination is incorrect. This happens mostly when 2 or more numbers match. I think the main one of the issues that complicates this is the fact that the combination can be allowed in any order, and also the same picture needs to become visible for different codes. E.g. 11 11 11 2 gives the same picture as 11 11 11 5 and so I have tried to group them rather than write the code out numerous times.
Here is the code I am currently using:
Here is the code I am currently using:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If Textbox1.Text = "11" And Textbox2.Text = "11" And Textbox3.Text = "11" And (Textbox4.Text = "1" Or "2" Or "3" Or "4" Or "5") Then PictureBox2.Visible = True Else PictureBox2.Visible = False If Textbox1.Text = "11" And Textbox2.Text = "11" And (Textbox3.Text = "1" Or "2" Or "3" Or "4" Or "5") And Textbox4.Text = "11" Then PictureBox3.Visible = True Else PictureBox3.Visible = False If Textbox1.Text = "11" And (Textbox2.Text = "1" Or "2" Or "3" Or "4" Or "5") And Textbox3.Text = "11" And Textbox4.Text = "11" Then PictureBox4.Visible = True Else PictureBox4.Visible = False If (Textbox1.Text = "1" Or "2" Or "3" Or "4" Or "5") And Textbox2.Text = "11" And Textbox3.Text = "11" And Textbox4.Text = "11" Then PictureBox1.Visible = True Else PictureBox1.Visible = False If (Textbox1.Text = "8" Or "9") And (Textbox2.Text = "8" Or "9") And (Textbox3.Text = "8" Or "9") And Textbox4.Text = "12" Then PictureBox5.Visible = True Else PictureBox5.Visible = False If (Textbox1.Text = "8" Or "9") And (Textbox2.Text = "8" Or "9") And Textbox3.Text = "12" And (Textbox4.Text = "8" Or "9") Then PictureBox6.Visible = True Else PictureBox6.Visible = False If (Textbox1.Text = "8" Or "9") And Textbox2.Text = "12" And (Textbox3.Text = "8" Or "9") And (Textbox4.Text = "8" Or "9") Then PictureBox7.Visible = True Else PictureBox7.Visible = False If Textbox1.Text = "12" And (Textbox2.Text = "8" Or "9") And (Textbox3.Text = "8" Or "9") And (Textbox4.Text = "8" Or "9") Then PictureBox8.Visible = True Else PictureBox8.Visible = False
Comment