Hey there!!!!
Well im somehow new to visual basic but I know some basic codes..So now i want to make something like a "Dont press the red button" game. With every click of the button the text of it will change but everytime i press it, it changes to the last text i wrote
Can anyone help me? I performed a searh but couldn't find anything :[
4 replies to this topic
#1
Posted 04 July 2011 - 01:28 PM
|
|
|
#2
Posted 04 July 2011 - 01:54 PM
Well, in order for us to help you, you have to provide the part of the source code where you do this text change you are talking about. Otherwise there's just no way for us to know how to solve your problem!
#3
Posted 04 July 2011 - 02:03 PM
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click)
If Button1.Text = ("1") Then
Button1.Text = ("2")
If Button1.Text = ("2") Then
Button1.Text = ("3")
End If
End If
End Sub
every time i click it i just get 3 and not 2 and then 3 im newb :P help pls?
#4
Posted 04 July 2011 - 03:20 PM
The problem is that you put the second if inside the first one. That way, you can never enter the second if because that would mean that you are inside the first one and that Text = "2".
What you really want is
What you really want is
If Button1.Text = "1" Then Button1.Text = "2" ElseIf Button1.Text = "2" Then Button1.Text = "3" Else Button1.Text = "1" End If
#5
Posted 04 July 2011 - 10:47 PM
aha thank you it worked
sorry for my stupidity
sorry for my stupidity
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









