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
相关推荐
Gofarlic_oms11 小时前
利用API实现ANSYS许可证管理自动化集成
运维·服务器·开发语言·matlab·自动化·负载均衡
ss2733 小时前
食谱推荐系统功能测试如何写?
java·数据库·spring boot·功能测试
l1t3 小时前
DeepSeek总结的数据库外部表
数据库
m0_674294643 小时前
如何编写SQL存储过程性能对比_记录执行时间评估优化效果
jvm·数据库·python
倔强的石头1063 小时前
【Linux指南】基础IO系列(八):实战衔接 —— 给微型 Shell 添加完整重定向功能
linux·运维·服务器
014-code3 小时前
CompletableFuture 实战模板(超时、组合、异常链处理)
java·数据库
运气好好的3 小时前
怎样开启phpMyAdmin的操作审计日志_记录每条执行的SQL
jvm·数据库·python
それども4 小时前
DELETE 和 TRUNCATE TABLE区别
java·数据库·mysql
冰暮流星4 小时前
javascript事件案例-全选框案例
服务器·前端·javascript
wenha4 小时前
数据库隔离级别
数据库·mysql·sqlserver·隔离级别