tags:

views:

70

answers:

2

Hi,

If i click button event in form1 form2 should be focus, if i click button event in form2 form1 should focus in c#

How can I do this ?

+1  A: 

Store a reference to the other form (ie Form1 has a reference to Form2) and in the button click event handlers, use:

otherFormInstance.Focus();
JoshJordan
+1  A: 

Microsoft recommends not calling Focus on a form, instead use the form's Activate method. Here is an excerpt from MSDN:

Focus is a low-level method intended primarily for custom control authors. Instead, application programmers should use the Select method or the ActiveControl property for child controls, or the Activate method for forms.

Chris Dunaway