I have another question! Please help!
I have another question for my game. (You can download the demo here: http://www.vbforums.com/showthread.php?686607)
In the game you find a note with a code to open the safe. The code is 131288, but how can I make that when you enter the code, you only go to the next screen when you enter the right code and when it's anything different that 131288 that it displays a messagebox with 'That's the wrong code' or something. This is what the screen looks like:
http://i.imgur.com/uSPMt.jpg
Right now if you type just 1 character in, it automatically goes to the next screen. This is the code:
Code:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Me.Hide()
Form10.Show()
End Sub
Can someone help me? Thanks in advance!
Re: I have another question! Please help!
I have changed the first post because I have another question!
Re: I have another question! Please help!
Please don't edit/remove the text from your earlier posts like that - it makes the thread very confusing for people (whether they are attempting to help you, or solve a similar problem), and it causes all kinds of complications, for you and others.
In addition to that, if you have a new question that isn't a direct extension of the original question (this one isn't) you should be posting it as a new thread, as it is easier for people to focus on the new issue.
Re: I have another question! Please help!
Quote:
it makes the thread very confusing for people
It certainly confused the hell out of me.
Quote:
Right now if you type just 1 character in
That's because you're not check what they've typed in. That even is going to fire every time they type a character into you textbox so unless you check that the content of the textbox is value you're looking for you're always going to move between forms. Just wrap the whole lot in: If TextBox1.Text = 131288
Re: I have another question! Please help!
Quote:
Originally Posted by
si_the_geek
Please don't edit/remove the text from your earlier posts like that - it makes the thread very confusing for people (whether they are attempting to help you, or solve a similar problem), and it causes all kinds of complications, for you and others.
In addition to that, if you have a new question that isn't a direct extension of the original question (this one isn't) you should be posting it as a new thread, as it is easier for people to focus on the new issue.
OK, next time I will create a new thread.
Quote:
Originally Posted by
FunkyDexter
That's because you're not check what they've typed in. That even is going to fire every time they type a character into you textbox so unless you check that the content of the textbox is value you're looking for you're always going to move between forms. Just wrap the whole lot in: If TextBox1.Text = 131288
Thanks! I added an 'Enter' button so you can enter text. This is the code now:
Code:
If TextBox1.Text = "131288" Then
Me.Hide()
Form10.Show()
Else
MessageBox.Show("That code is not correct!")
End If