| public partial class MainFrm: Form { private void MainFrm _Load(object sender, EventArgs e) { Middle.sendEvent += new Middle.SendMessage(this.DoMethod); } public void DoMethod(string getstr) { listBox1.Items.Add(getstr); } } ChildFrm.cs: public partial class ChildFrm: Form { public ChildFrm () { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Middle.DoSendMessage(this.textBox1.Text); textBox1.Text = ""; textBox1.Focus(); } } Middle.cs: public static class Middle { public delegate void SendMessage(string str); public static event SendMessage sendEvent; public static void DoSendMessage(string str) { sendEvent(str); } } |
| static class Program { [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Application.Run(new Form1()); Form1 mainFrm = new Form1(); childFrm secondFrm = new childFrm(); secondFrm.Show(); Application.Run(mainFrm); } } |
![]() | asp.net mvc中的拦截器 | 12-02 |
![]() | asp.net使用Mysql乱码处理 | 11-19 |
![]() | ASP.NET中Cookie的使用 | 11-10 |
![]() | 在Asp.net MVC中使用Repeater | 10-27 |
![]() | 如何对ASP.NET进行性能优化 | 09-24 |
![]() | 把网页中的电话号码生成图片的ASP程序 | 11-23 |
![]() | 通过避免下列10个常见ASP.NET缺陷使网站平 | 06-03 |
![]() | Asp.Net、Ado.net 数据库编程超级攻略 | 06-03 |