I have a textbox (paymentAmount) binded to a database (sql server). When the database was designed the paymentAmount is smallMoney. When the user put an amount in the textbox other that an numeric amount, nothing happens. It seems to wait for the user to enter a numeric number. How come the rest of the code doesn't run until there is a numeric number entered?the textbox for payment amount is: xPaymentsTextBoxPrivate Sub xSaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles xSaveButton.Click Dim rowsAdded As Integer Dim paymentAmount As Decimal Dim isValid As Boolean = False isValid = Decimal.TryParse(Me.xPaymentsTextBox.Text, paymentAmount) If isValid = True Then If Me.xTransactionDateDateTimePicker.Checked = True Then Try Me.TransactionsBindingSource.EndEdit() rowsAdded = Me.TransactionsTableAdapter.Update(Me.DataSetAddPayment.Transactions) If rowsAdded > 0 Then MessageBox.Show("Your transaction has been added to the database.", _ "Transaction Added", MessageBoxButtons.OK, MessageBoxIcon.Information) Me.Close() Else MessageBox.Show("No transaction was added.", "Transaction Error", _ MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Close() End If Catch ex As NoNullAllowedException MessageBox.Show("Not all required files have valid data.", "Data Error", _ MessageBoxButtons.OK, MessageBoxIcon.Error) Catch ex As DataException MessageBox.Show(ex.Message, ex.GetType.ToString) Catch ex As SqlException MessageBox.Show(ex.Number & ex.Message, ex.GetType.ToString) End Try Else MessageBox.Show("Make sure the check box is checked for the transaction date", _ "Transaction Date Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.xTransactionDateDateTimePicker.Focus() End If Else MessageBox.Show("Please enter a valid numeric amount for your payment", _ "Payment Amount Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.xPaymentsTextBox.Focus() Me.xPaymentsTextBox.Clear() End If End Sub![]()
![]()