How to keep focus on a control?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, friends,

In VB6, we have SetFocus() to keep cursor in a masked box if the format is
not right. In c#.net 2005, what is the corresponding function/method? I tried
BringToFront(), it did not work. Focus still left from wrong-formatted-date
masked box and went to another control.

Thanks.
 
Andrew said:
In VB6, we have SetFocus() to keep cursor in a masked box if the format is
not right. In c#.net 2005, what is the corresponding function/method? I
tried
BringToFront(), it did not work. Focus still left from
wrong-formatted-date
masked box and went to another control.

Maybe you are looking for the control's 'Focus' and 'Select' methods.
 
Hello, friends,

In VB6, we have SetFocus() to keep cursor in a masked box if the format is
not right. In c#.net 2005, what is the corresponding function/method? I tried
BringToFront(), it did not work. Focus still left from wrong-formatted-date
masked box and went to another control.

Thanks.

Check the Validating event. There are also the Focus() and Select()
methods.
 
Back
Top