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
1105
How to prevent Datasource to be written into the InitializeComponent?
posted

Hi,

 

I have a grid which inherits from ultragrid. The Datasource and DataMember are given to it at runtime in the Contrustructor.

How can I prevent the inherited class to write this information into the initializeComponent Method of the Form?

regards

Stefan

  • 37774
    Suggested Answer
    posted

    Stefan,

    You might want to try using the Load event instead of the constructor.  You could also check the DesignTime property of the parent form before assigning this value (i.e. by calling this.FindForm(), checking if the form is null or DesignTime is true).  The reason this is being serialized is because when you create your new control on the design surface, the DataSource is set; when VS tells the grid to serialize, it will do so with all the properties that have been set.

    -Matt