2个回答
展开全部
Form1里边有一个ListBox叫listBox
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
form2 = new Form2();
form2.Show();
}
private Form2 form2;
private void listBox_SelectedIndexChanged(object sender, EventArgs e)
{
form2.SetRBText(listBox.SelectedItem.ToString());
}
}
Form2里边有一个RichTextBox,叫richTextBox
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public Form2 SetRBText(string str)
{
richTextBox.Text = str;
return this;
}
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
form2 = new Form2();
form2.Show();
}
private Form2 form2;
private void listBox_SelectedIndexChanged(object sender, EventArgs e)
{
form2.SetRBText(listBox.SelectedItem.ToString());
}
}
Form2里边有一个RichTextBox,叫richTextBox
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public Form2 SetRBText(string str)
{
richTextBox.Text = str;
return this;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询