tags:

views:

25

answers:

0

Hello i am new to the VC++ 6.0(MFC).I want to Validate a EditBox only number entry, including (+ or - values).I used SpanIncluding function of CString. my code is
CString value;
value=m_strEditBox.SpanIncluding ("0123456789-+");

if(!(value==m_strEditBox && value.GetLength ()==m_strEditBox.GetLength ()))
{
 MessageBox(_T("Invalid Entry"),MB_OK,MB_ICONINFORMATION);

 return;
}

it works fine only when user enters like -10 or +15.

But if user enters wrong value like 10- or -14- or +15-20 or ----- or +++++ for this type of values entry ,the above condition will not work it will not fire the error Message like Invalid Entry.For this i am getting strange output so how to restrict or validate for this type of entry in EditBox.Help me. Thanks in Advance.