C# 数据绑定 未完

csharp 复制代码
List<int> integerList = new List<int> { 0 };
        BindingSource bs = new BindingSource();
        public Form1() {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e) {
            bs.DataSource = integerList;
            label1.DataBindings.Add("Text", bs, "");
        }
        private void button1_Click(object sender, EventArgs e) {
            integerList[0]++;
            bs.ResetBindings(false);
        }

上述代码效果为点击ButtonLable的值++

需要注意一下几点

DataBindings.Add
相关推荐
芒果披萨11 小时前
Linux文件类基础命令行1
linux·运维·服务器
萝卜白菜。11 小时前
ClassCastException: oracle.sql.BLOB cannot be cast to oracle.sql.BLOB问题
数据库·oracle
duoduo_sing11 小时前
多服务器数据集中自动化备份方案
服务器·自动化·异地备份·自动备份·多服务备份·智能备份
czlczl2002092511 小时前
Mysql的多版本快照MVCC机制与Mysql四种隔离级别
数据库·mysql
唐青枫11 小时前
C#.NET Span 深入解析:零拷贝内存切片与高性能实战
c#·.net
有想法的py工程师11 小时前
PostgreSQL 事务隔离级别详解(以及与MySQL实现差异)
数据库·mysql·postgresql
chuxinweihui11 小时前
MySQL内外连接
数据库·mysql
杨云龙UP12 小时前
ODA服务器RAC节点2/u01分区在线扩容操作记录及后续处理流程(Linux LVM + ext4 文件系统在线扩容操作手册)_20260307
linux·运维·服务器·数据库·ubuntu·centos
parafeeee19 小时前
程序人生-Hello’s P2P
数据库·后端·asp.net
欲买桂花同载酒58219 小时前
程序人生-Hello’s P2P
运维·服务器·数据库