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
160
Windows Form Inheritence with WinGrid Control
posted

I have an application where many tables are used to drive data in the application itself. These tables need some basic CReate, Update and Delete functionality for which the WinGrid control is of great utility.

Each table needs to provide some basis functionality like print out of the data in the database plus some other odds and ends. But each table needs to provide this. To help reduce code, I created a base class that inherits from Windows Form and place a Print button, Binding Navigator and the WinGrid control on it. The WinGrid is NOT bound to any data source.

I now inherit from my base Windows Form class with the controls and try to configure the WinGrid to bind to the specific data source it will work with. My problem is that the configuration of the WinGrid is not saving properly. In other words, I will set the data source yet none of the data is fetched. I will set the appearance of certain cells and appearance does not appear during runtime.

In trouble shooting this issue, I did come across the fact my WinGrid was a Private member of the base class. I changed this to Protected so the inherited class would have access. I now see some of the designer customization in the inherited class but I’m still having trouble accessing the data but I see the “columns” now but without the desired appearance.

Are there issues that I need to be aware of when inheriting a Form with WinGrid control on it?

Any help would be greatly appreciated.

 Regards,

Aditya

Parents
  • 37774
    posted

    Aditya,

    I'm not really sure I understand your issue.  The grid will not automatically try to populate the data source to which it is bound as it is not the grid's responsibility.  Are you certain that the data source is being populated?  There are some issues with visual inheritance in the Visual Studio designer, so it's possible the appearances are related to this.  You would be best off doing some work like this in the InitializeLayout event of the grid, or InitializeRow.

    -Matt

Reply Children