I'm trying to have a Textfield lose it's leading zeroes when the user leaves the field. I made the following "Leave" event but it's not working. It works for the first half however to set it back to 1 if it's blank or if a user entered 0.
I tried following the advice on this answer, but it didn't work:
Removing leading zeroes from a string
Private Sub FirstTableTxt_Leave(sender As System.Object, e As System.EventArgs) Handles FirstTableTxt.Leave
If FirstTableTxt.Text = "" Or FirstTableTxt.Text = "0" Then
FirstTableTxt.Text = "1"
End If
FirstTableTxt.Text = Convert.ToString(CInt(FirstTableTxt.Text))
End Sub
EDIT: I see where I went wrong with this. I was thinking that Convert.Toxxxx returns it to the same variable.