Hi there,
since years and several versions of the NetAdvantage library my colleagues and I are experiencing a strange behavior which all of us costs a lot of time in total so that's the reason why I'm posting it now.
We have a lot of business classes that are responsible to exchange data with the database server. We are using the MS BindingSource to fill up the WinGrid with our business object's data which works great. Our problem is that WinGrid sometimes temporary looses the 'connection' to the data schema of the business object and when this is estrablished again all column arrangements including groups are lost. This is extremely annoying and time consuming because every time you've to start from scratch by setting it up newly in Visual Studio Designer. I've now written a class that handles that programmatically during FormLoad to overcome that.
For a long time I didn't know where this problem comes from but now I think I've at least a little glue. If I've opened a form containing a WinGrid in Visual Studio Designer, debug the application from Visual Studio with having the form still visible in Designer (the Visual Studio Tab with that form is selected), close the application then all columns in WinGrid disappear in Designer. If I start to design the WinGrid there is no Data Schema established thus I cannot do anything in the column arrangement overview. If I close the WinGrid Designer the Data Schema is established afterwards. When I'm lucky the column arrangements are still there but sometimes they are lost.
When I close the form in Designer after ending debugging the application and the re-open it again this works also fine. It seems that there is a problem when the form is open in the Designer when the debugging session is started and then ended. I’ve set NewBandLoadStyle and NewColumnStyle properties of WinGrid DisplayLayout to Hide but that didn’t change anything.
As I said at the beginning we do have this problem with all NetAdvantage libraries starting from 2007.3, with Visual Studio 2008 and 2010 running on Windows XP Professional 32bit and Windows 7 Professional 64bit.
I wonder, that no other people do have similar problems?
Regards, Wolfgang
Hello Wolfgang
qbupoew said:I see is that it contains the library version of the grid which makes perfect sense but will it work if I save the Display Layout with a certain version to a file to open it with any future version of the library i.e. is this backward compatible?
Yes, you could save your layout for exmaple with version 10.3 and then you will be able to load the same layout in version 12.1.
Please do not hesitate to write us if you have any questions.
Regards
Hi Georgi,
thanks for the hint for saving and loading the display layout of the grid, didn't know that so I tried to write it to a file which worked fine. I looked into the file to see which format it is, it looks rather binary but what I see is that it contains the library version of the grid which makes perfect sense but will it work if I save the Display Layout with a certain version to a file to open it with any future version of the library i.e. is this backward compatible?
Anyhow, the solution with the separate class dealing with the column definitions has proven itself to be the best for us. If offers also a function to create the necessary code out of an existing grid which is more or less the same as saving the display layout to file.
I assume, that there are other users outside struggling more with that problem so maybe they have good sample code to show?
Hello Wolfgang,
Maybe one possible approach could be if you are using Save and Load methods of the UltraGrid`s layout. For example:
ultraGrid1.DisplayLayout.Save()
ultraGrid1.DisplayLayout.Load()
Please let me know if you have any further questions or if you have another sample with your issue. I`ll be glad to take a look.
after having a long weekend I realized some progress on that issue. Unfortunately the behavior of that problem is varying little bit so in that small example you've been investigating it's the most obvious case because here it happens every time when running the application. I have UserControls which work for weeks and suddenly they loose their entire layout and I had to re-arrange the columns hide the ones that should not be shown etc. which is very time consuming. After I did this several times I've written an own class that manages the layout of the grid after everything is set-up by calling a function in that class from the Load-event. In the meantime I'm using this class for most of my UltraGrids. I've one dialog that once in a day shows the behavior which does not use my managing class.
I think, that the problem is how objects are created in the InitializeComponent function so that maybe the Grid gets initialized before the binding source is fully initialized?
Have you been able to resolve your issue ? If you still have any concerns or questions I will be glad to help. If you need any additional assistance don’t hesitate to ask.