Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validating a Edit Box

Status
Not open for further replies.

Jastper

Programmer
Oct 4, 2002
13
0
0
GB
Hi All, I am trying to develop a database editor using Visual C++ and need to make sure that only numeric data is entered into an edit box and is required to be 8 characters lon. This edit box will be then be used to update the MS ACCESS database. Can anyone help me on solving this problem?
 
Your post does not specify "what" part you need help with.
Code:
if( 99999999 < atol( msg))
  AfxMessageBox(&quot;Amount OK&quot;);
else
  AfxMessageBox(&quot;Amount invalid&quot;);

-pete
 
Pardon me if I butt in but perhaps we are asking the same question. I also need to validate an edit box. I created a message handler for &quot;KillFocus&quot;. Unfortunately, in that hander, the value of the edit box seems to not have been set. Has &quot;DoDataExchange&quot; not been done at this point? If so how do I verify the edit box value? If it has been done then I guess I need to examine how I use that variable more closely to find out why it was not set even though there is data in the edit box.
 
>> how I use that variable more

what variable?

Code:
void CMyDialog::LostFocusHandler(...){
  UpdateData();  // run DDX
  // now validate the data
}

does that help?
-pete
 
Yep, at least for me. That was the missing piece of the puzzle. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top