Click here to Skip to main content
15,919,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to set focus on the textbox(present in form1) from form2 in C#.

I have two Forms:

Form1(Textbox1.Text, and SearchButton for the Form2)
Form2(Button)

when I run the app (Form1), then press the searchbutton to open the Form2.
then inside the Form2 ,press the button1, (Form2 disappear)and jump the cursor into the textbox1 inside Form1.



plz, plz, plz, Anyone Can Help Me
Posted
Updated 3-Nov-12 5:13am
v2

1 solution

Look at the Show() and Hide() property of Form using Intellisense and also, the Focus() property of TextBox.

You can call
C#
Form2.Hide()
to hide a form at runtime or
C#
Form1.Show()
and
C#
TextBox1.Focus()
when Form1 is shown.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900