how can I warn to make a choice for numeric edit box?
-
When I add information to access table ,I use this code ! set.m_access_attribute = GetDlgItemInt (IDC_EDIT1); How can I warn to fill edit box if it is forgotten:confused: ? emroz
-
When I add information to access table ,I use this code ! set.m_access_attribute = GetDlgItemInt (IDC_EDIT1); How can I warn to fill edit box if it is forgotten:confused: ? emroz
GetDlgItemInt has two more parameters. The actual syntax is:
UINT GetDlgItemInt( int nID, BOOL* lpTrans = NULL, BOOL bSigned = TRUE ) const;
If the edit box doesn't contain a valid numeric value then pTrans would become 0.BOOL pTrans;
int iValue = GetDlgItemInt( IDC_EDIT1, &pTrans );
if( pTrans == 0 )
AfxMessageBox( "Please enter a numerical value!");
else
set.m_access_attribute = iValue;I haven't tried to compile the code so it might contain errors. Another way is to force the edit box accept only integers and that can be done in the resource editor. Right-click on the edit box, select properties, and then in the styles tab select Number. // Afterall, I realized that even my comment lines have bugs When one cannot invent, one must at least improve (in bed).-My latest fortune cookie