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
相关推荐
魑-魅-魍-魉9 分钟前
金仓数据库(KingbaseES)Windows 安装避坑指南:从 Connection Refused 到服务启动的完整实战记录
数据库·金仓
终生成长者16 分钟前
Kubernetes常用操作与概念总结--从服务器导出mongo数据,并下载到本地
服务器·容器·kubernetes
UP_Continue20 分钟前
Linux--动静态库
linux·运维·服务器
游乐码23 分钟前
c#递归函数
算法·c#
CheungChunChiu26 分钟前
Linux 音频系统全景解析:PipeWire、PulseAudio 与 ALSA 的层次关系
linux·运维·服务器·audio
你真是饿了1 小时前
7.进程间通信
linux·运维·服务器
chlk1231 小时前
聊聊索引:为何 B + 树能撑起数据库的半壁江山?
数据库·mysql
TEC_INO1 小时前
Linux_12:通过多线程获取VENC的H264码流数据
linux·运维·服务器
宁酱醇1 小时前
ORACLE_建表+增改查+删
数据库·oracle
爬山算法1 小时前
MongoDB(8)什么是聚合(Aggregation)?
数据库·mongodb