J
JPSutor
I currently have this code in my kepup event of a text box. It works
except for the fact that if the number
25,000 or any number is put in then the user arrows to the left of the
third zero and tries to replace the number 0 with a 4, this is the
result
25,004
Here is my code. Any help would be appreciated.
public static void KeyStroke_FormatNumericText(string number,TextBox
txtBx) {
try {
long iReturn
=Int64.Parse(number,System.Globalization.NumberStyles.AllowThousands);
txtBx.Text = iReturn.ToString("#,0");
txtBx.SelectionStart = txtBx.Text.Length;
}
catch(Exception ex) {
Debug.WriteLine(ex.ToString());
}
}
except for the fact that if the number
25,000 or any number is put in then the user arrows to the left of the
third zero and tries to replace the number 0 with a 4, this is the
result
25,004
Here is my code. Any help would be appreciated.
public static void KeyStroke_FormatNumericText(string number,TextBox
txtBx) {
try {
long iReturn
=Int64.Parse(number,System.Globalization.NumberStyles.AllowThousands);
txtBx.Text = iReturn.ToString("#,0");
txtBx.SelectionStart = txtBx.Text.Length;
}
catch(Exception ex) {
Debug.WriteLine(ex.ToString());
}
}