View Poll Results: How would u handle this scenario
- Voters
- 4. You may not vote on this poll
-
Message Box
-
Keypress
-
Masked Edit
-
Auto Correct
-
Other
-
Aug 22nd, 2001, 04:04 AM
#1
Thread Starter
PowerPoster
Pesky errors, Pesky users
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
-
Aug 22nd, 2001, 05:03 AM
#2
Member
I would say Autocorrect.
If they enter more than the max allowed, correct to the maximum and if they enter less than the min allowed, correct to the minimum.
IUnknown
Using VB6.0 (sp5), SQL Server 2000, Visual Studio .Net
-
Aug 22nd, 2001, 07:17 AM
#3
Frenzied Member
In general it is better HCI to prevent errors from occurring in the first place than to correct errors once they've happened. You need to let the user know what they did wrong, though, if you're preventing an error and doing something they weren't expecting instead. So, I'd use the masked edit technique but let the user know with a label or something (not a messagebox because that interrupts the user's input and often they're not looking at the screen while typing, plus they might miss it if they press space or something) and maybe a 'ding' if they did something that wasn't allowed.
The problem with ###.###, though, is that you can enter 999.999, so you'd need to validate each keypress and autocorrect where necessary, making sure to communicate with the user what's happened.
Harry.
"From one thing, know ten thousand things."
-
Aug 22nd, 2001, 08:51 AM
#4
Fanatic Member
Personally, I think I'd allow them to do it and code around it, so that in the Validate event you remove the "Percent" from the end. I have a couple of reasons for this:
- If you're going to have to do some coding, you might as well do it to allow the user as much freedom as possible.
- It can be kept in a separate module and used for other controls that don't have easily accessible masked edits - grids, for example.
- You can't control the messages thrown up by masked edits.
Of course, it's all just a matter of opinion.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|