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
相关推荐
打码人的日常分享10 分钟前
智慧城市一网统管建设方案,新型城市整体建设方案(PPT)
大数据·运维·服务器·人工智能·信息可视化·智慧城市
风掣长空1 小时前
Google Test (gtest) 新手完全指南:从入门到精通
运维·服务器·网络
2301_800256111 小时前
8.2 空间查询基本组件 核心知识点总结
数据库·人工智能·算法
吃喝不愁霸王餐APP开发者1 小时前
霸王餐API文档自动化:Spring REST Docs与Asciidoctor多模块聚合
数据库·spring·自动化
地球驾驶员1 小时前
NX二次开发C#----C#和C++的二次开发程序如何签名?
c#
默恋~微凉2 小时前
Mysql 备份与还原
数据库·mysql
LEEE@FPGA2 小时前
ZYNQ MPSOC linux hello world
linux·运维·服务器
郝学胜-神的一滴2 小时前
Linux定时器编程:深入理解setitimer函数
linux·服务器·开发语言·c++·程序人生
研华科技Advantech2 小时前
储能AI化的数据瓶颈与破解路径:研华全栈方案实践分析
数据库·人工智能·储能·智能体
大锦终2 小时前
【MySQL】索引
数据库·mysql