今晚,在上網百到了一個很簡單而又很絕的辦法:
String Str="123.4"; try { Convert.ToDecimal(tStr); MessageBox.Show("Str是數字"); //是數字 } catch (Exception) { MessageBox.Show("Str不是數字");//不是數字 }
可能還有想不到問題,等待大家的交流。
今晚,在上網百到了一個很簡單而又很絕的辦法:
String Str="123.4"; try { Convert.ToDecimal(tStr); MessageBox.Show("Str是數字"); //是數字 } catch (Exception) { MessageBox.Show("Str不是數字");//不是數字 }
可能還有想不到問題,等待大家的交流。