原理:两个窗体绑定同一个静态对象。这里只是为了说明问题,并没进行静态对象进行清理方面的工作。

类结构图
使用数据绑定实现多窗口间的数据同步

 程序运行效果如图

使用数据绑定实现多窗口间的数据同步

具体实现
MainForm.cs

使用数据绑定实现多窗口间的数据同步using System;
使用数据绑定实现多窗口间的数据同步
using System.Collections.Generic;
使用数据绑定实现多窗口间的数据同步
using System.Text;
使用数据绑定实现多窗口间的数据同步
using System.Windows.Forms;
使用数据绑定实现多窗口间的数据同步
使用数据绑定实现多窗口间的数据同步
namespace WindowsApplication1



 DetailForm.cs

使用数据绑定实现多窗口间的数据同步using System;
使用数据绑定实现多窗口间的数据同步
using System.Collections.Generic;
使用数据绑定实现多窗口间的数据同步
using System.Text;
使用数据绑定实现多窗口间的数据同步
using System.Windows.Forms;
使用数据绑定实现多窗口间的数据同步
使用数据绑定实现多窗口间的数据同步
namespace WindowsApplication1

 ModuleClass.cs

使用数据绑定实现多窗口间的数据同步using System;
使用数据绑定实现多窗口间的数据同步
using System.Collections.Generic;
使用数据绑定实现多窗口间的数据同步
using System.Text;
使用数据绑定实现多窗口间的数据同步
使用数据绑定实现多窗口间的数据同步
namespace WindowsApplication1

 

StaticClass.cs

使用数据绑定实现多窗口间的数据同步using System;
使用数据绑定实现多窗口间的数据同步
using System.Collections.Generic;
使用数据绑定实现多窗口间的数据同步
using System.Text;
使用数据绑定实现多窗口间的数据同步
使用数据绑定实现多窗口间的数据同步
namespace WindowsApplication1


Program.cs

使用数据绑定实现多窗口间的数据同步using System;
使用数据绑定实现多窗口间的数据同步
using System.Collections.Generic;
使用数据绑定实现多窗口间的数据同步
using System.Windows.Forms;
使用数据绑定实现多窗口间的数据同步
使用数据绑定实现多窗口间的数据同步
namespace WindowsApplication1
}

 

相关文章:

  • 2021-10-27
  • 2021-07-31
  • 2021-10-16
  • 2021-12-09
  • 2021-09-07
  • 2021-04-04
  • 2021-12-31
  • 2022-01-21
猜你喜欢
  • 2021-04-09
  • 2022-02-04
  • 2022-01-13
  • 2022-12-23
  • 2021-05-19
  • 2021-10-22
相关资源
相似解决方案