void MyDlg :: OnEnchangeEdit()
//could you give some some direction on how to get the text entered in the edit control
// Should I use the control value variable of the edit control to save the input
// I am confused here, I would like some direction. Thanks
temp = m_editvariable;
Function(1st parameter, temp) // this function will check the text entered in the edit control, with the default value and display appropriate message
Use 3 radio buttons; default select the first option (1L).
Or leave it "empty" (tri-state) and warn if no selection made.
Standard stuff that everyone recognizes.
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
I'm trying to validate user input entered in Edit control. When it is empty or user enter invalid input or enter input that is not in the database to display some message saying "invalid input" right under the edit control box as a text.
What will be the best way to do this. Any suggestions?
Do it "live" as the user types in value (mostly with the EN_CHANGE message); each time the user types something, use GetWindowText and start searching the Database; this is somewhat complicated as the search can take a long time compared to the speed the user types (you would need some way to stop the current search and start a new one each time a new character is typed in); warn the user with visual feedback (red highlights while the input is not valid.
Do it when the user clicks on the "ok" (or "search") button; on the OnOK (or "search") , get the full string with GetWindowText and do some validation and search the Database; easier to implement, you can just wait for the whole search to be done and warn user after with a simple SetWindowText to your static control (or edit control) that will display the error.
Personally, I would do "2" it is simpler and quicker (unless there is a requirement to do live input validation).