Setting focus to controls?

  • Thread starter Thread starter IMRAN SAROIA
  • Start date Start date
I

IMRAN SAROIA

Hi!

Please advise how to set focus to any control on Web
and Windows Forms.

Regards

Imran
 
Hi Imran,

Windows Forms:

The Focus() method of the Control class sets focus to the control.
Like: textbox1.Focus(); will set the foucs to the text box in the form.
The control should be selectabe for setting the foucs to it. Hence some
controls like the Panel and group box cannot have the foucs set.

Web:
Here is a nice KB Article on HowTo Set Focus to Web Form Controls By
Using Client-Side Script :
http://support.microsoft.com/default.aspx?scid=KB;EN-US;816166

HTH,
APG
 
Back
Top