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
相关推荐
A-刘晨阳18 分钟前
K8s集群中的数据库新范式:KES-Operator解锁部署、扩缩容、备份全链路自动化
运维·数据库·云原生·kubernetes·自动化
大模型码小白31 分钟前
Harness Engineering 驾驭工程:从使用到项目实战
大数据·数据库·人工智能·python·spring
JoyCong19981 小时前
知识科普:ToDesk鸿蒙版高级功能免费开放使用了!
运维·服务器·华为·智能手机·harmonyos·远程工作
yu_zhidun1 小时前
企业电脑数据防泄密软件选型:内网终端 DLP 落地实战指南
服务器·网络·电脑
cjp5601 小时前
011. UG二次开发,UG管道通讯服务器与wpf客户端通讯
linux·运维·服务器
abcyuu1 小时前
福州中小企业业财一体化系统权限管理与数据安全实践方案
大数据·网络·数据库
灵境(虚幻知音)2 小时前
效能评估指标体系构建:方法、流程与模板
android·数据库
UIU1142 小时前
补码运算与整数溢出(上
学习·c#·补码·补码运算
沈管家AI数字员工2 小时前
对话式数据分析实操:从自然语言到可视化图表的全流程
数据库·人工智能·ai·oracle·数据分析
网硕互联的小客服2 小时前
原生IP,住宅IP,ISPIP,机房IP分别都有什么区别?适合用于什么站点或者程序?
服务器·网络·tcp/ip