将数字的指定 String 表示形式转换为等效的单精度浮点数字。[C#]
public static float ToSingle(
string value
);
try
{
float f= Convert.ToSingle(textBox.text);
}
catch(,,,)
{,,,,,,,,,,,
}
public static float ToSingle(
string value
);
try
{
float f= Convert.ToSingle(textBox.text);
}
catch(,,,)
{,,,,,,,,,,,
}
float[] ff=new float[cc.Length];
for(int i=0;i<cc.Length;i++)
ff[i]=Convert.ToSingle(cc[i].ToString());
this.textBox2.Text=cc[2].ToString();
以上只是个简单事例,还要做的工作很多,如判断float等等