VB.net 动态添加的控件 无法删除 怎么办?
本帖最后由 wuyazhe 于 2010-12-07 11:29:10 编辑
'代码如下:
Private Sub CBSelect_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CBSelect.CheckedChanged
If Not PubdekDataIsNull() Then Return
Dim comBox As ComboBox = New System.Windows.Forms.ComboBox
If CBSelect.Checked = True Then
LdekName1.Visible = False
LdekName2.Visible = False
CBSelect.Location = New Point(Me.TreeViewDE.Location.X, CBSelect.Location.Y)
comBox.Location = New System.Drawing.Point(Me.TreeViewDE.Location.X + CBSelect.Size.Width, CBSelect.Location.Y)
comBox.Size = New System.Drawing.Size(100, 16)
Me.SplitContainer3.Panel2.Controls.Add(comBox)
comBox.Visible = True
Else
LdekName1.Visible = True
LdekName2.Visible = True
comBox.Visible = False
CBSelect.Location = New Point(Me.TreeViewDE.Size.Width - Me.CBSelect.Size.Width, CBSelect.Location.Y)
'Me.SplitContainer3.Panel2.Controls.Remove(comBox)
End If
End Sub