Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1470
UserControl vs Panel
posted

I recognized a strange behaviour from the UltraGrid, based on the type of the grids parent control.

If the parent control is a System.Windows.Forms.UserControl, the GridObjects (like bands, columns, rows etc.) are created earlier than, when the parent control is a System.Windows.Forms.Panel.

Is there any explanation for this behavior? We changed the type of the parent control and we got many exceptions, because we accessed those GridObjects at a time when the grid is not builded completely.

I cannot attach a sample, because its deep in our application engine. And i cannot attach the whole application with source code, because of obvious reasons.

 

Regards

Parents
  • 22852
    Offline posted

    Hello,

    If you are using the designer to set up the WinGrid, then when you are using the WinGrid or any other control the settings that you set at design time will be in InitializeComponent of the UserControl and this would be called from the constructor of that UserControl.  When a Panel is used, the settings will be in InitializeComponent of the Form.

    Since the constructor needs to be called before objects are accessed, it makes sence that when the WinGrid is used on a UserControl will have the logic from the designer executed earlier. 

    If what I have described above doesn't match what you are doing, please provide me more details.

    Alan

Reply Children
No Data