将表单1中的值drom文本框传递到文本框表单2而不使用按钮

问题描述:

如何在第二个框中获取相同的文本,该文本位于另一个没有单击按钮的表单中?

在同一表单中,第一个框架正常工作。





private void Profile_SelectedIndexChanged(对象发送者,EventArgs e)

{

//名称空间HowToUseACombobox

ActiveProfile.Text = Profile.Text ;;

//}命名空间WordDocument1

ActiveProfile.Text = Daily_Name ;;





我尝试了什么:



我试过的是注释中的描述

How can I get the same Text in the second box, that is located in another form without a button click?
Within the same Form the first one is working correctly.


private void Profile_SelectedIndexChanged(object sender, EventArgs e)
{
//namespace HowToUseACombobox
ActiveProfile.Text = Profile.Text;;
// }namespace WordDocument1
ActiveProfile.Text = Daily_Name;;
)

What I have tried:

What I have tried is descript in the comment

这不是导致问题的按钮位 - 它是你有两个独立的形式,它们应该保持分开。

这不难做,但你究竟是怎么做的这取决于表格之间的关系。如果Form1创建Form2的实例并调用Show或ShowDialog,那么Form1是父,因为想要更好的单词。

找出两个表单之间的关系并查看相应的表单其中:

在两个表格之间传递信息,部分1:父母对孩子 [ ^ ]

转移两种表格之间的信息,第2部分:儿童到父母 [ ^ ]

转移信息有两种形式,第3部分:儿童到儿童 [ ^ ]
It's not the button bit that causes the problem - it's that you have two separate forms, and they should remain separate.
It's not difficult to do, but exactly how you do it depends on the relationship between the forms. If Form1 creates the instance of Form2 and calls Show or ShowDialog, then Form1 is it's "parent" for want of a better word.
Work out the "relationship" between the two forms and see the appropriate one of these:
Transferring information between two forms, Part 1: Parent to Child[^]
Transferring information between two forms, Part 2: Child to Parent[^]
Transferring information between two forms, Part 3: Child to Child[^]