C#UserControl - 已经进行了循环控制引用

时间:2014-03-10 12:20:29

标签: c# winforms

我想访问fdtlc.Controls而不是fdtlc.flpFlightList.Controls

public partial class FlightDetailListControl : UserControl
{
    public ControlCollection Controls //Error circular control reference has been made
    {
        get
        {
            return flpFlightList.Controls; // flpFlightList is a FlowLayoutPanel
        }
    }


    public FlightDetailListControl()
    {
        InitializeComponent();
    }
}

1 个答案:

答案 0 :(得分:0)

FlightDetailListControl和FlowLayoutPanel都是Controls,因此它们都已经有一个名为Controls的ControllCollection继承自UserControl。您必须在FlightDetailListControl中为您的属性选择另一个名称。