MFC vc ++は、テキストボックスに入力された値が数値かどうかを決定します(編集ボックスが数値かどうか)
方法1:
CString str;
GetDlgItem(IDC_EDIT1)-> GetWindowText(str);
char c;
for(int i = 0; i <str.GetLength(); i ++)
{
c = str.GetAt(i);
if(c> = '0' && c <= '9' || c == '。')
MessageBox( "は数値です");
そうしないと
MessageBox( "not a number");
}
方法2:
if(str.SpanInlusion(_T( "0123456789。"))== str)
MessageBox( "は数値です");
そうしないと
MessageBox( "not a number ');