Results 1 to 4 of 4

Thread: textbox validate event does not fire

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2001
    Posts
    69

    textbox validate event does not fire

    I created an activeX textbox control which is just a simple textbox control with some extra properties and stuff.

    But for some reason the validate event does not fire.
    I have a property called max which indicates what the maximum value is the user can enter.
    Then when the control losses the focus want to fire this event.

    I know I could use the lostfocus event, but what some times I will populate my new textbox with a value form a database and then the lostfocus event will not fire since I never entered the control. The value of the control was set using code.

    Anyone knows how to fire the validate event?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    How about from the Change event?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2001
    Posts
    69

    Nope, thats not it.

    The change event will then fire everytime the user types a key and thats not what I want. i only want to evaluate the contents of the textbox once the user completed the whole field.
    Any other ideas?

  4. #4
    New Member
    Join Date
    Mar 2002
    Posts
    8
    This is a rather sneaky way to accomplish what you want, I think. Combine all three steps:
    1) Use the lost_focus event to fire off your validate event.
    2) Use the key_down event to set a module-level boolean value (call it bKeyJustPressed) to true.
    3) Use the change event to check if bKeyJustPressed is true. If it's true, just set it to false and do nothing else. If it's not true, then fire off the validate event, since the value of the control was changed thru code.

    Good luck.

    Kevin

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