View Poll Results: How would u handle this scenario

Voters
4. You may not vote on this poll
  • Message Box

    0 0%
  • Keypress

    0 0%
  • Masked Edit

    1 25.00%
  • Auto Correct

    3 75.00%
  • Other

    0 0%
Results 1 to 4 of 4

Thread: Pesky errors, Pesky users

  1. #1

    Thread Starter
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274

    Question 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
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

  2. #2
    Member IUnknown's Avatar
    Join Date
    May 2001
    Location
    Staffordshire, England
    Posts
    59
    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

  3. #3
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    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."

  4. #4
    Fanatic Member InvisibleDuncan's Avatar
    Join Date
    May 2001
    Location
    Eating jam.
    Posts
    819
    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.
    Indecisiveness is the key to flexibility.

    www.mangojacks.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width