csharp中的控制数组 [英] Control array in csharp

查看:66
本文介绍了csharp中的控制数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作标签数组,我该怎么做.
预先大于thanx

i m trying to make a array of labels how can i do this.
thanx in advance

推荐答案

Label[] labels = new Label[numLabels];
Label lbl = new Label();
labels[0] = lbl;



或使用List< Label>



or use a List<Label>

List<Label> labels = new List<Label>();
Label lbl = new Label();
labels.Add(lbl);


请尝试此操作.

Please try this.

Label[] lbl = new Label[3];
            lbl[0] = new Label();
            lbl[0].Text = "abc";
            lbl[1] = new Label();
            lbl[1].Text = "def";
            lbl[2] = new Label();
            lbl[2].Text = "pqrs";


非常有用,我一直在寻找它很久,直到看到您的帖子!非常非常有用,谢谢!
very useful I was looking for it for so long till I saw your post! very very useful thank you!


这篇关于csharp中的控制数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆