I am use the textbox value like 1455.23, use the round function my output is 0000145523 but customer not enter float values like 1234 my output is 0000123400 pls give me suggestion
my code is format.cs
public bool formatAmount(float flAmount, out string strOutput)
{
bool bval = false;
float rounded = (float)Math.Round(flAmount, 2);
if(rounded!=null)
{
flAmount = flAmount * 100;
strOutput = Convert.ToString(flAmount);
bVal = true;
}
return bVal;
}
In my asp page code like this
string ods;
float a = Convert.Todecimal(txtSSA.Text);
string sss = oclsUtility.formatAmount(a, out ods);
If I’m understanding you, you need to keep leading 0 if user input is float and if not removes them. You can try this: