I need an Activex Ctl consisting of a EditBox which allows only Alphabetics and
I need an Activex Ctl consisting of a EditBox which allows only Alphabetics and numeric characters. It should not allow other characters to be entered. Is there any easy method like KeyAscii( ) method in VB? Could you tell me.
[226 byte] By [
vijay_jcet] at [2007-11-18 1:39:37]

# 1 Re: I need an Activex Ctl consisting of a EditBox which allows only Alphabetics and
I dont have seen such method , but there is very simple way of doing so.
You will have to provide your own WindowProcedure for Edit box bu subclassing it , where you can process WM_CHAR or WM_KEYDOWN messages and process then if key isnt alphanumeric then simply dont return to default window procedure.
# 2 Re: I need an Activex Ctl consisting of a EditBox which allows only Alphabetics and
You cand do something like dis
void CEditCtl::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (!CheckChar(nChar))
return;
else
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
bool CEditCtl::CheckChar (UINT nChar)
{
if ((nChar >= 'a' && nChar <='z') || (nChar >='A' && nChar <='Z') || (nChar >='0' and nChar <='9'))
return true;
else
return false;
}