How to set focus after checking a DataGridTextBox in WinForms.

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

    How to set focus after checking a DataGridTextBox in WinForms.



    I'm usng the WinForms DataGrid control and want to validate the phone
    fields and put the focus back if an error ocurrs.
    I have a Leave message handler attached to the TextBox of the phone
    number column, and validate the phone number therein against a regular
    expression. If it comes back bad, I want to put up a message and then
    set the focus back to that specific text box that they just left which
    contains the error.
    I run into trouble trying to set the focus back. The text box has a
    CanFocus property of false. I've tried calling .Focus() on the text
    box but it produces a nasty loopback of being traped and not being abe
    to get out of the control from that point.

    Does anyone know how to do this?

    Thanks,
    Glorfindel02

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
Working...