I am coding an ATM interface for a VB.net project. I wish to use command buttons to enter the code, just like one would do so at an actual ATM. I am using 4 separate labels or text boxes (whichever is more convenient), to print the separate numbers to, once the command buttons are clicked by the user.
The problem I am having is that once the 1st button is clicked, it is continually being overwritten, by clicking a second button. I have tried making the labels or text boxes... enabled = False, but it is still overwritten when the second button is clicked. Is there any means of bypassing this problem and getting the first label or text box locked off, after the first click?
ATM PIN code for VB.net ProjectATM PIN code for VB.net Project
Page 1 of 1
2 Replies - 9042 Views - Last Post: 07 March 2009 - 09:56 AM
#3
Re: ATM PIN code for VB.net Project
Posted 07 March 2009 - 08:31 AM
It's hard to say what the problem is without seeing the code you have for the click events. If I were to guess I'd say that your code looks like this.
When you do it this way you are assigning the value n to the object Text, so it will overwrite the existing value. What you want to do is append which can be achieved by using += instead of just =.
' Button 1' Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As_ System.EventArgs) Handles Button1.Click Textbox1.Text = "1" End Sub ' Button 2' Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As_ System.EventArgs) Handles Button1.Click Textbox1.Text = "2" End Sub
When you do it this way you are assigning the value n to the object Text, so it will overwrite the existing value. What you want to do is append which can be achieved by using += instead of just =.
#4
Re: ATM PIN code for VB.net Project
Posted 07 March 2009 - 09:56 AM
Yeah, that works perfectly. Knew it was going to be something very simple. Thanks for that. Much appreciated.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote


|