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
相关推荐
武子康几秒前
Java-151 深入浅出 MongoDB 索引详解 性能优化:慢查询分析 索引调优 快速定位并解决慢查询
java·开发语言·数据库·sql·mongodb·性能优化·nosql
Mr Aokey2 小时前
解决Redis数据丢失难题:深入理解RDB与AOF持久化机制
数据库·redis·缓存
KaiwuDB2 小时前
深度剖析:KWDB SQL 编译与优化策略
数据库
翰林小院2 小时前
【MongoDB】 MongoDB index overview
数据库·mongodb
Aubrey-J2 小时前
Linux中快速部署Elasticsearch(基础&TLS配置)
linux·服务器·elasticsearch
Albert Edison2 小时前
【MySQL】数据类型
数据库·mysql·adb·oracle
遇见火星2 小时前
MYSQL-物理备份(xtrabackup)使用指南
数据库·mysql·adb
爱可生开源社区2 小时前
医疗业务系统升级,这家三甲医院为何牵手 OceanBase?(SQLServer->OceanBase)
数据库
奥尔特星云大使3 小时前
详细的Linux系统更新yum源的教程
linux·运维·服务器·ubuntu·centos·yum源·epel源
tritone3 小时前
在优豆云免费云服务器上初探SSH与SCP的便捷操作
运维·服务器·ssh