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=='.'){//符合数字的条件}
else MessageBox( "发现非数字存在! ", "提示 ",MB_OK);
}
MFC 判断文本框输入的值是否为数字
最新推荐文章于 2021-12-13 00:39:23 发布