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