When I create a new form-class, which derives from RadFrom, and I override the method OnLoad, then OnLoad is called during construction. This should never happen!
As Microsoft states: "The OnLoad method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class."
See: https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.form.onload?view=windowsdesktop-6.0
The OnLoad method can be used to load controls with data. But these controls are not even initialized, because the method InitializeComponent has not been called yet.
You are right. I made an override of OnLoad(Size), and not OnLoad(EventArgs).
Hello Martin,
I guess you are referring to the OnLoad method that receives a System.Drawing.Size as a parameter. Please note that this method is part of the internal API of the RadForm and it is called at initialization in its constructor.
The Form.OnLoad(EventArgs) which fires the Load event of the form is called after initializing the controls and this behavior is not changed. You can override it and use it to load the controls with data without attaching a delegate.
As we are not changing the behavior of the Form.OnLoad(EventArgs) and it still gets called after the constructor we will be declining this item.
Regards,
Hristo
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.