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
相关推荐
科技小花2 小时前
全球化深水区,数据治理成为企业出海 “核心竞争力”
大数据·数据库·人工智能·数据治理·数据中台·全球化
X56613 小时前
如何在 Laravel 中正确保存嵌套动态表单数据(主服务与子服务)
jvm·数据库·python
青梅橘子皮4 小时前
Linux---基本指令
linux·运维·服务器
虹科网络安全4 小时前
艾体宝干货|数据复制详解:类型、原理与适用场景
java·开发语言·数据库
2301_771717215 小时前
解决mysql报错:1406, Data too long for column
android·数据库·mysql
小江的记录本5 小时前
【Kafka核心】架构模型:Producer、Broker、Consumer、Consumer Group、Topic、Partition、Replica
java·数据库·分布式·后端·搜索引擎·架构·kafka
cui_ruicheng5 小时前
Linux进程间通信(三):System V IPC与共享内存
linux·运维·服务器
dvjr cloi5 小时前
MySQL Workbench菜单汉化为中文
android·数据库·mysql
运维全栈笔记5 小时前
Linux安装配置Tomcat保姆级教程:从部署到性能调优
linux·服务器·中间件·tomcat·apache·web
dFObBIMmai6 小时前
MySQL主从同步中大事务导致的延迟_如何拆分大事务优化同步
jvm·数据库·python