I have 3 text boxes that have user input to preform calculations. What I would like to do is if the user inputs improper values to share the error code messages with out having to define the messages in each one of the text boxes using the same code. I have looked into Public Share but am not sure that is the way to go, having a hard time figuring it out anyway.
Here is the code for one of the text boxes:
'text box for user input of the loan term and verifies the input values Private Sub txtLoanTerm_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLoanTerm.TextChanged If Me.txtLoanTerm.Text <> "" Then If IsNumeric(txtLoanTerm.Text) Then 'checks input for numeric value If txtLoanTerm.Text > 0 Then 'checks input to make sure number entered is more than zero Else 'show error if conditions are not met MessageBox.Show("Input Error Please Enter a Numeric value Greater Than Zero") Me.txtLoanTerm.Text = "" Me.txtLoanTerm.Focus() End If Else 'show error if conditions are not met MessageBox.Show("Input Error Please enter a valid numeric value") Me.txtLoanTerm.Text = "" Me.txtLoanTerm.Focus() End If End If End Sub
As it is now I use this code 3 times, just change the name for the text box.
Can anyone help me out on this please?