c# - Get Parent of custom TextBox control -
when creating custom control extends textbox, inside oncreatecontrol() override, parent null. when extending other controls such button, isn't null. checking following code , adding form , various container controls:
protected override void oncreatecontrol() { base.oncreatecontrol(); messagebox.show((parent == null).tostring()); //true when extending textbox, false when extending button }
what can retrieve parent of control when added control, ensuring same code work regardless of control extend?
Comments
Post a Comment