Group,
I've found code that will format a number found in a TextBox to display it with two decimal places. It looks like this:
Private Sub txbStateTaxPcnt_Leave(sender As System.Object, e As System.EventArgs) Handles txbStateTaxPcnt.Leave
stateSlsTax = Convert.ToInt32(txbStateTaxPcnt.Text)
txbStateTaxPcnt.Text = stateSlsTax.ToString("n2")
End Sub
This works great when a whole number is entered into the textbox. However when I enter a number with decimal places (ex. '2.25'), I get an error message saying, "Input string was not in a correct format." My assumption is that this "number" is recognized as a string instead of the integer that it really is.
Is there something different that I should use in place of "Convert.ToInt32(txbStateTaxPcnt.Text)"? If so, am I going to need to use a If/Then statement to differenciate the two different inputs?
As always, thanks for the help.
Don