//windows form
float f=0.00
string str=f.ToString("0.00");
MessageBox.Show(str);
//web form
Response.Write("<script>alert('"+str+"')</script>");
float f=0.00
string str=f.ToString("0.00");
MessageBox.Show(str);
//web form
Response.Write("<script>alert('"+str+"')</script>");
example:
float a = 0.00;
string b = a.ToString();
Response.write(b);
double i = 0.00;
string s = string.Format("{0:f}",i);关于输出格式,参见
ms-help://MS.MSDNQTR.2003FEB.2052/cpref/html/frlrfsystemglobalizationnumberformatinfoclasstopic.htm