我有一个 MainForm 和 AnotherForm。AnotherForm 通过 MainForm 的 menuItem 访问。
AnotherForm 有 listView。当用户单击一个项目时,我想获取字符串元素并将其传递给 MainForm 的文本框,因此该元素显示在那里并且 AnotherForm 已关闭。到目前为止,AnotherForm 已关闭,但 MainForm 的文本框中没有显示任何内容。有什么建议么?
private void listView1_ItemActivate(object sender, EventArgs e)
{
string input = listView1.SelectedItem[0].ToString();
MainForm mainF = new MainForm(input);// called the constructor
this.Close(); //close this form and pass the input to MainForm
mainF.inputTextBox.Text = input;
mainF.loadThis(input);
}