Hi there,
I have used the below code to format an int value to a mask text box in C#.
How can I avoid replacing the zeros in between the the numbers other than the zero’s in the front of the number.
How can I do this, as an example
00000234 will be displayed as 234
How can I display 00230234 as 230234, for the moment it displays as 23 234.
How can I avoid this situation
thanxxxxxx
String amt = reader[11].ToString();
if ((amt == "0.00") || (String.IsNullOrEmpty(amt)))
mtxtAmt.Text = "";
else
{
decimal d;
decimal.TryParse(amt, out d);
String Val1 = d.ToString("$00000000000000.00");
int index1 = Val1.IndexOf(".");
String val1 = Val1.Substring(0, index1);
String FValue1 = val1.Replace("0", " ");
String LValue1 = Val1.Substring(index1, (Val1.Length - index1));
mtxtAmt.Text = FValue1 + LValue1;
}