1
我有一組一個小組的內部動態創建與下面的代碼調用特定的用戶控件動態創建
Dim X As Integer = 4
Dim Y As Integer = 0
For XRule As Integer = 0 To ArrayRuleNames.Length - 1
Dim MyRule As New RuleControl
Dim Location As Point
Location.X = X
Location.Y = Y
With MyRule
.RuleNameGpb.Text = ArrayRuleNames(XRule)
.RuleNumberTxt.Text = ArrayRuleNumbers(XRule)
.RuleNumberTxt.Tag = XRule
.SendBtn.Text = "Read"
.Parent = Me
.Location = Location
.Visible = True
End With
Panel.Controls.Add(MyRule)
Y += 80
Next
內的每個用戶控件的用戶控件的有像複選框和文本框的一些對象,我需要設置爲True o錯誤Checked屬性並從主窗體(WinForm)的Text屬性上寫入文本。
所以,我正在考慮在上面的代碼中定義一個名稱,然後通過名稱來調用它們,這個概念是否正確,或者我應該以不同的方式做到這一點?