beachbum
Aug 22nd, 2001, 04:04 AM
Hi All
Here is the scenario...
You have a textbox that accepts a value from 0 to 100 as a percentage. We step into the future and see that the user is going to enter this exactly (no quotes) "110 percent". How would you code to deal with this?
Assume no other controls allowed (except Masked Edit) and also that say 3 decimal places can be entered so that Maxlength is not useful cos that is not the point of the exercise.
1. Popup an Error Msg box telling the user that they entered the wrong value and to try again
2. Stop the user from entering the letters for "percent" in the Keypress event (or using API's)
3. Use a Masked edit control for ###.###
4. Modify the entry to a valid value eg 100 in the textbox validate event and notify the user using say red backcolor and maybe a noise.
5. Some other way or combination
Regards
Stuart
Here is the scenario...
You have a textbox that accepts a value from 0 to 100 as a percentage. We step into the future and see that the user is going to enter this exactly (no quotes) "110 percent". How would you code to deal with this?
Assume no other controls allowed (except Masked Edit) and also that say 3 decimal places can be entered so that Maxlength is not useful cos that is not the point of the exercise.
1. Popup an Error Msg box telling the user that they entered the wrong value and to try again
2. Stop the user from entering the letters for "percent" in the Keypress event (or using API's)
3. Use a Masked edit control for ###.###
4. Modify the entry to a valid value eg 100 in the textbox validate event and notify the user using say red backcolor and maybe a noise.
5. Some other way or combination
Regards
Stuart