我想将焦点设置为C#中来自form2的文本框(位于form1中). [英] I want to set focus to a textbox (present in form1) from form2 in C#.

查看:64
本文介绍了我想将焦点设置为C#中来自form2的文本框(位于form1中).的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将焦点放在C#中来自form2的文本框(在form1中存在).
我有两种形式:

Form1(Textbox1.Text和Form2的SearchButton)
Form2(按钮)

当我运行应用程序(Form1)时,请按搜索按钮以打开Form2.
然后在Form2内,按一下button1,(Form2消失)并将光标跳到Form1内的textbox1中.



plz,plz,plz,任何人都可以帮助我

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

推荐答案

使用Intellisense以及Focus()属性查看Form的Show()Hide()属性的TextBox.

你可以打电话
Look at the Show() and Hide() property of Form using Intellisense and also, the Focus() property of TextBox.

You can call
Form2.Hide()

在运行时隐藏表单,或

Form1.Show()

TextBox1.Focus()

.


这篇关于我想将焦点设置为C#中来自form2的文本框(位于form1中).的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆