This should probably have been posted to the Windows forum.
Derive a new control from CEdit and call it CAlphaEdit. Overload the OnChar() method and check if characters entered were non-char, if so, block them.
Code:
class CAlphaEdit : public CEdit
{
protected:
afx_msg void OnChar(UINT, UINT, UINT);
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CSsnEdit, CEdit)
ON_WM_CHAR()
END_MESSAGE_MAP()
void CAlphaEdit::OnChar(UINT nChar, UINT nRepCount, UINT nFlags)
{
if (_istalpha(nChar))
CEdit::OnChar(nChar, nRepCount, nFlags);
}
If you need anything else, or don't understand this example, post back.