Hello all,
Here is the situation.
I have a textbox that takes a number as input. Upon leaving the textbox it uses that number to determine what are allowable entries in other parts of the form. What I need though is to only allow numbers to be entered. The following is the code that I have tried:
Private Sub txtAmount_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtAmount.Leave
Dim back As System.Windows.Forms.KeyEventArgs
Select Case back.KeyCode
Case Keys.Shift, Keys.Tab, Keys.Back, Keys.Left, Keys.Right, Keys.Up, Keys.Delete, Keys.Down, Keys.Home, Keys.End, Keys.A, Keys.B, Keys.C, Keys.D
txtAmount.Text = ""
Return
End Select
The error that I receive on my select case line is :
Object reference not set to an instance of an object.
What am I doing wrong here? Any ideas?
Any help, as always, is greatly appreciated.
Brian
Here is the situation.
I have a textbox that takes a number as input. Upon leaving the textbox it uses that number to determine what are allowable entries in other parts of the form. What I need though is to only allow numbers to be entered. The following is the code that I have tried:
Private Sub txtAmount_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtAmount.Leave
Dim back As System.Windows.Forms.KeyEventArgs
Select Case back.KeyCode
Case Keys.Shift, Keys.Tab, Keys.Back, Keys.Left, Keys.Right, Keys.Up, Keys.Delete, Keys.Down, Keys.Home, Keys.End, Keys.A, Keys.B, Keys.C, Keys.D
txtAmount.Text = ""
Return
End Select
The error that I receive on my select case line is :
Object reference not set to an instance of an object.
What am I doing wrong here? Any ideas?
Any help, as always, is greatly appreciated.
Brian