juggernot
Well-known member
- Joined
- Sep 28, 2006
- Messages
- 173
- Programming Experience
- Beginner
How do you make an if statement where you want two things to happen if one thing is true? Those of you who read my other posts know I'm trying to make a math program. I've posted an example of my code below:
If Me.TextBox1.Text = "" Then
Me.PictureBox1.Visible = True
Else
If Me.TextBox1.Text = Val(Me.MathLabel1.Text) + Val(Me.MathLabel2.Text) Then Me.PictureBox2.Visible = True
Score += 1
If Me.TextBox1.Text <= Val(Me.MathLabel1.Text) + Val(Me.MathLabel2.Text) Or Me.TextBox1.Text >= Val(Me.MathLabel1.Text) + Val(Me.MathLabel2.Text) Then Me.PictureBox1.Visible = True
End If
A quick explanation, the different picture boxes are x's and checmarks to show if you are correct, I want to add 1 point to the variable score when you get it right. If you are wondering why I didn't use an else statement for the wrong answer, I am a noob and was running into trouble with 'else'. It occasionaly gave me an error about needing to be preceeded by an if, which It was.
If Me.TextBox1.Text = "" Then
Me.PictureBox1.Visible = True
Else
If Me.TextBox1.Text = Val(Me.MathLabel1.Text) + Val(Me.MathLabel2.Text) Then Me.PictureBox2.Visible = True
Score += 1
If Me.TextBox1.Text <= Val(Me.MathLabel1.Text) + Val(Me.MathLabel2.Text) Or Me.TextBox1.Text >= Val(Me.MathLabel1.Text) + Val(Me.MathLabel2.Text) Then Me.PictureBox1.Visible = True
End If
A quick explanation, the different picture boxes are x's and checmarks to show if you are correct, I want to add 1 point to the variable score when you get it right. If you are wondering why I didn't use an else statement for the wrong answer, I am a noob and was running into trouble with 'else'. It occasionaly gave me an error about needing to be preceeded by an if, which It was.