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.
I don't have a link to the issue since I only know from experience that it has come up; this is not an issue with Infragistics, but rather an issue with how Visual Studio itself handled visual inheritance in terms of serializing the various object. You could certainly contact Developer Support if you would like them to look further into this issue, but I just wanted to mentioned that some of these problems do exist in the IDE itself.
Okay, that worked. I was able to load a run time and it worked just fine. The file attachment is the latest version of Winzip. That may be the problem with the file. Do you have a link to the issues with the Designer? And do you know when it will be resolved?
The file attachment seems to be corrupted as I cannot seem to view or decompress any of the files properly. As I had mentioned, however, there are some issues with Visual Inheritance in the Visual Studio designer that could cause these kinds of behavior. The easiest workaround, as I mentioned, is to create the appearances and set the data source in code. Another option is to create the layout at design-time then save it to a file, then load it at run-time through the grid.DisplayLayout.Load/LoadFromXML methods.