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
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
Let's see if I can clarify what I'm trying to do. I have a base class that contains 4 controls on it. One of them is the WinGrid control. In the base class it is unbound and unconfigured .
In the inherited class, I try to configure the WinGrid control using Designer and the configurations like data source and "appearance" and it does not work.
I've attached the base class and the inherited class for reference. They may help clear up the confusion surrounding the issue.