#region FormatNumber
public string FormatNumber(string strNumber)
{
string test;
try
{
if (strNumber.Length == 1)
{
return strNumber;
}
else if (string.Compare(strNumber, "0", false) == 0)
{
return strNumber;
}
else if (strNumber.Length == 2)
{
return strNumber;
}
else if (strNumber.Length == 3)
{
return strNumber;
}
else if (strNumber.Length == 4)
{
return strNumber.Substring(0,1)+","+strNumber.Substring(1);
}
else if (strNumber.Length == 5)
{
return strNumber.Substring(0, 2) + "," + strNumber.Substring(2);
}
else if (strNumber.Length == 6)
{
test= strNumber.Substring(0, 3) + "," + strNumber.Substring(3);
return test;
}
else if (strNumber.Length == 7)
{
return strNumber.Substring(0, 1) + "," + strNumber.Substring(1, 3) + "," + strNumber.Substring(4);
}
else if (strNumber.Length == 8)
{
return strNumber.Substring(0, 2) + "," + strNumber.Substring(2, 3) + "," + strNumber.Substring(5);
}
else if (strNumber.Length == 9)
{
return strNumber.Substring(0, 3) + "," + strNumber.Substring(3, 3) + "," + strNumber.Substring(6);
}
else if (strNumber.Length == 10)
{
return strNumber.Substring(0, 1) + "," + strNumber.Substring(2, 3) + "," + strNumber.Substring(4, 3) + "," + strNumber.Substring(7);
}
else if (strNumber.Length == 11)
{
return strNumber.Substring(0, 2) + "," + strNumber.Substring(2, 3) + "," + strNumber.Substring(5, 3) + "," + strNumber.Substring(8);
}
else if (strNumber.Length == 12)
{
return strNumber.Substring(0, 3) + "," + strNumber.Substring(3, 3) + "," + strNumber.Substring(6, 3) + "," + strNumber.Substring(9);
}
else
{
return "false";
}
}
catch (NullReferenceException nullex)
{
objError.LoggerError(nullex);
lblErrorMessage.Text = nullex.Message;
return "FALSE";
}
catch (SqlException sqlex)
{
objError.LoggerError(sqlex);
lblErrorMessage.Text = sqlex.Message;
return "FALSE";
}
catch (Exception ex)
{
objError.LoggerError(ex);
lblErrorMessage.Text = ex.Message;
return "FALSE";
}
}
#endregion
this is the solution i for comma b/w numbers......