ListView Columns Name屬性為空

这里写图片描述
ListView設定列,并給列的Name屬性賦值,
但是是要用ListView1.Colomns[0].Name時,卻發現這個值為空

到 .Designer.cs文件里去看卻發現 只給Text屬性賦值Name屬性沒有賦值,設計時填寫的a只作為一個變量,並不是Name的值

      this.a.Text = "列1";
            // 
            // b
            //        
            this.b.Text = "列2";
            // 
            // c
            //      
            this.c.Text = "列3";
            // 
            // d
            //        
            this.d.Text = "列4";

發現這個問題就好辦了,已是手動給Name賦值,這樣ListView1.Colomns[0].Name就能取到值了

            this.a.Name = "a";
            this.a.Text = "列1";
            // 
            // b
            // 
            this.b.Name = "b";
            this.b.Text = "列2";
            // 
            // c
            // 
            this.c.Name = "c";
            this.c.Text = "列3";
            // 
            // d
            // 
            this.d.Name = "d";
            this.d.Text = "列4";
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值