Tab control -switching

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JPS

    Tab control -switching

    A user is on a control (textbox) on a tab and I have code in the leave
    event of the textbox that must validate input.
    After typing in the text box the user then clicks on another tab.
    My leave event fires (text box), and I try and set focus back on the
    textbox, but the tab control does not let me. Instead the user goes to
    the next selected tab after saying OK to my dialog box (leave event).
    How can I keep them focused on the correct tab?

  • Bruce Wood

    #2
    Re: Tab control -switching

    Don't use the Leave event to do validation. Use the Validating event,
    and set e.Cancel = true on the event arguments if validation fails. The
    user will not be able to leave the text box if validation fails.

    Comment

    • JPS

      #3
      Re: Tab control -switching

      Thanks Bruce. this helped out imensley

      Comment

      Working...