1
我在窗口的构造函数中运行以下代码。 “标签”被添加,但没有其他控件显示在屏幕上。如果我调试newTab.Controls,那里有几个控件。为什么他们不出现在屏幕上,我只看到“标签”控件。控件不会添加到tabpage VB.NET
感谢
Dim graphlist As ArrayList = New ArrayList
For Each funct As TL_FUNCTION In functionlist
If (funct.functionname = functi) Then
If Not (graphlist.Contains(funct.picture)) Then
graphlist.Add(funct.picture)
End If
End If
Next
For Each picture In graphlist
Dim NewTab As New TabPage
NewTab.Name = picture
NewTab.Text = NewTab.Name
Me.TabControl1.Controls.Add(NewTab)
Me.TabControl1.SelectedIndex = Me.TabControl1.TabCount - 1
For Each func As TL_FUNCTION In functionlist
If (func.picture = picture) Then
Dim label As Label = New Label
label.Text = func.curve.ToString
NewTab.Controls.Add(label) 'This label shows up
Dim key As String
Dim values() As String
For Each key In func.values.Keys
values = func.values.GetValues(key)
For Each value As String In values
Dim label2 As New Label
label2.Text = key.ToString
Dim textb As TextBox = New TextBox
textb.Text = value
NewTab.Controls.Add(label2) 'this one is not shown on the tab
NewTab.Controls.Add(textb) 'this one is not shown on the tab
Next value
Next key
End If
Next
Next
你有没有打过电话'.REFRESH()'你的标签控制,一旦循环完成? – 2012-07-25 11:51:59
是的尝试.Refresh(),没有工作。 – benst 2012-07-25 11:55:03
'ArrayList' [is obsolete](http://stackoverflow.com/a/5063253/284240)。 – 2012-07-25 11:55:30