1
我創建了包含面板的用戶定義控件,面板中有一個標籤和一個文本框。現在,在我的父母表單中有一個流程佈局面板。我將我的用戶定義控件添加到流佈局面板。如何從父窗體中的用戶定義控件獲取控件的值
這裏是我使用得到控制值的代碼,但它總是給我檢查ListBox控件值:
// Here 'panel_Attribute' is my parent form panel to which I have added the controls
Control.ControlCollection listControls = panel_Attribute.Controls;
foreach (Control attributeControl in listControls)
{
if (attributeControl is Control)
{
log.Debug("attributeControl Values are attributeControl attributeControl.Name" +
attributeControl.Name + ", Value: " + attributeControl.Text);
attributeList.Add(((PHShowAttributeControl)attributeControl).
ProbeRawProjectTaskAttributeEvent);
//attributeList.Add(GetControlValues());
}
}
'(Window.Controls [x]作爲UserControl).Control.Property'? –