在我的表单中,我有一个面板。在一个循环中,我在此面板中创建了许多标签,但速度太慢。
因此,看来在循环中创建标签列表并将它们添加到面板中后应该更快。
这是我的代码:
Dim listLabels as new list(of label)
for a=0 to 100
dim lbl as new label
label.name="label" & a.Tostring
listLabels.add(lbl)
next
myPanel.controls.addrange(listLabels)
错误:“List(of Label)”类型的值无法转换为“Control()”
你能帮我吗?
谢谢