This is just one Form of my project, I was wondering if how can I create a form that has a numeric Keypad (Buttons) that has 3 text boxes
TEXTBOX 1 : OLD PIN CODE
TEXTBOX 2 : NEW PIN CODE
TEXTBOX 3 : CONFIRM NEW PIN CODE
I have 10 buttons 0,1,2...9
Actually it's easy if I use 1 text box only, but now with 3 text boxes I found a little bit difficulty
I am using a touch screen for my project that's why I need this built in numeric keypad to input the PIN CODE in the specific areas..
I tried using an IF STATEMENT that when the focus is set in TEXTBOX1 Then it should write to TEXTBOX1 only then when the TEXTBOX2 is clicked then it should now Write to TEXTBOX2
here is my CODE:
Any help will be appreciated. Thank youCode:Public Class frmpin Private Sub cmd1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd1.Click If txtpassword.Focused = True Then txtpassword.Text = txtpassword.Text + "1" ElseIf txtnew.Focused = True Then txtnew.Text = txtnew.Text + "1" ElseIf txtnew.Focused = True Then txtnew2.Text = txtnew2.Text + "1" End If End Sub Private Sub cmd2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd2.Click If txtpassword.Focused = True Then txtpassword.Text = txtpassword.Text + "2" ElseIf txtnew.Focused = True Then txtnew.Text = txtnew.Text + "2" ElseIf txtnew.Focused = True Then txtnew2.Text = txtnew2.Text + "2" End If End Sub Private Sub cmd3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd3.Click If txtpassword.Focused = True Then txtpassword.Text = txtpassword.Text + "3" ElseIf txtnew.Focused = True Then txtnew.Text = txtnew.Text + "3" ElseIf txtnew.Focused = True Then txtnew2.Text = txtnew2.Text + "3" End If End Sub Private Sub cmd4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd4.Click If txtpassword.Focused = True Then txtpassword.Text = txtpassword.Text + "4" ElseIf txtnew.Focused = True Then txtnew.Text = txtnew.Text + "4" ElseIf txtnew.Focused = True Then txtnew2.Text = txtnew2.Text + "4" End If End Sub Private Sub cmd5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd5.Click If txtpassword.Focused = True Then txtpassword.Text = txtpassword.Text + "5" ElseIf txtnew.Focused = True Then txtnew.Text = txtnew.Text + "5" ElseIf txtnew.Focused = True Then txtnew2.Text = txtnew2.Text + "5" End If End Sub Private Sub cmd6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd6.Click If txtpassword.Focused = True Then txtpassword.Text = txtpassword.Text + "6" ElseIf txtnew.Focused = True Then txtnew.Text = txtnew.Text + "6" ElseIf txtnew.Focused = True Then txtnew2.Text = txtnew2.Text + "6" End If End Sub Private Sub cmd7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd7.Click If txtpassword.Focused = True Then txtpassword.Text = txtpassword.Text + "7" ElseIf txtnew.Focused = True Then txtnew.Text = txtnew.Text + "7" ElseIf txtnew.Focused = True Then txtnew2.Text = txtnew2.Text + "7" End If End Sub Private Sub cmd8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd8.Click If txtpassword.Focused = True Then txtpassword.Text = txtpassword.Text + "8" ElseIf txtnew.Focused = True Then txtnew.Text = txtnew.Text + "8" ElseIf txtnew.Focused = True Then txtnew2.Text = txtnew2.Text + "8" End If End Sub Private Sub cmd9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd9.Click If txtpassword.Focused Then txtpassword.Text = txtpassword.Text + "9" ElseIf txtnew.Focused Then txtnew.Text = txtnew.Text + "9" ElseIf txtnew.Focused Then txtnew2.Text = txtnew2.Text + "9" End If End Sub Private Sub cmd0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd0.Click If txtpassword.Focus Then txtpassword.Text = txtpassword.Text + "0" ElseIf txtnew.Focused Then txtnew.Text = txtnew.Text + "0" ElseIf txtnew.Focused Then txtnew2.Text = txtnew2.Text + "0" End If End Sub Private Sub cmdcancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcancel.Click Me.Hide() End Sub Private Sub txtpassword_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles txtpassword.MouseClick txtpassword.Text = "" End Sub Private Sub txtnew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtnew.Click txtnew.Text = "" End Sub Private Sub txtnew2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtnew2.Click txtnew2.Text = "" If txtnew2.Text <> txtnew.Text Then MsgBox("Please Verify Your Password again! Passwords Should Match!") End If End Sub Private Sub frmpin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class


Reply With Quote


