感謝這裏的幫助,我設法遞歸循環遍歷我的winform中的所有控件,並找到我的子分類控件,但是當我嘗試更新我的用戶定義的屬性_key和_value對象CTRL不公開他們:(我使用 ctrlContainer 下面是這個無法在winforms控件中找到新的子分類屬性
foreach (Control ctrl in ctrlContainer.Controls)
{
// code to find my specific sub classed textBox
// found my control
// now update my new property _key
ctrl._key does not exist :(
I know the ctrl exists and is valid because ctrl.Text = "I've just added this text" works.
_key is visible when looking at the control in the form designer.
}
誰能給我一個提示,我在做什麼錯? 由於通過調用形式。
這一個爲我工作,因爲的foreach(在ctrlContainer.Controls.OfType()VAR CTRL)搞砸了,看起來對任何文本框控件如組盒內部的代碼。 –
Hunt
2011-12-16 16:12:18