Get access to parent control from user control - C#

后端 未结 9 1865
甜味超标
甜味超标 2020-11-29 06:42

How do I get access to the parent controls of user control in C# (winform). I am using the following code but it is not applicable on all types controls such as ListBox.

9条回答
  •  日久生厌
    2020-11-29 07:01

    You can get the Parent of a control via

    myControl.Parent
    

    See MSDN: Control.Parent

提交回复
热议问题