UserControl Load event not fired

前端 未结 3 1804
名媛妹妹
名媛妹妹 2020-12-06 20:11

I have WinForms application. My Form derived class has UserControl derived class. I simply put several controls into one UserControl to simplify reuse. The Load

3条回答
  •  鱼传尺愫
    2020-12-06 20:21

    One reason for the Load event to stop firing is when you have a parent of your control that does something like this

        protected override void OnLoad(EventArgs e)
        {
         //do something
        }
    

    you always need to make sure to do this

        protected override void OnLoad(EventArgs e)
        {
         //do something
         base.OnLoad(e);
        }
    

提交回复
热议问题