从form2“发送消息处”输入的字符串自动同步到Form3“接收消息处” 从form3“发送消息处”输入的字符串自动同步到Form2“接收消息处” 注意是自动同步
但是2到3可以同步 3到2却不能同步 求大神
1. using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Show();
//Form3 f3 = new Form3();
// f3.Show();
}
}
}
2
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication5
{
public partial class Form2 : Form
{
Form3 f3;
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
f3 = new Form3();
f3.Show();
}
private void richTextBox2_TextChanged(object sender, EventArgs e)
{
f3.richTextBox1.Text = this.richTextBox2.Text;
}
}
}
3
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication5
{
public partial class Form3 : Form
{
Form2 f2;
public Form3()
{
InitializeComponent();
}
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
}
private void richTextBox2_TextChanged(object sender, EventArgs e)
{
f2.richTextBox1.Text = this.richTextBox2.Text; //可能是这里的问题
}
private void Form3_Load(object sender, EventArgs e)
{
f2 = new Form2();
// f2.Show();
}
}
}
编程刚刚入门 帮忙看一下 谢谢
|