Hi there,
I am evaluating FlyGrid for its usefulness in a non-databound way, and thus wish to be able to add columns to a FlyGrid in the form designer, and then add rows programmatically at runtime.
However, if I add a FlyGrid to a UserControl in the form designer, and then immediately try to add a column to the Columns.Items collection on the brand new FlyGrid control, I get the following exception and the control gets disabled by Visual Studio 2005 (only to subsequently come crashing down when i try to delete the FlyGrid from the form).
System.InvalidCastException: Unable to cast object of type 'NineRays.Windows.Forms.Grids.Column' to type 'NineRays.Windows.Forms.Grids.Column'.
at NineRays.Windows.Forms.Grids.Columns.[][]9()
at NineRays.Windows.Forms.Grids.Columns.[][])
at NineRays.Windows.Forms.Grids.Columns.get_VisibleColumns()
at NineRays.Windows.Forms.Grids.FlyGridViewPort.GetTotalWidth(Int32 startCol)
at NineRays.Windows.Forms.FlyGrid.[]9([]8, Graphics, Rectangle)
at NineRays.Windows.Forms.FlyGrid.[]9(FlyGridViewPort, Graphics, Rectangle)
at NineRays.Windows.Forms.FlyGrid.[][](PaintEventArgs, FlyGridViewPort)
at NineRays.Windows.Forms.FlyGrid.OnPaint(PaintEventArgs)...
This happens for all the different types of columns that can be added to the Columns.Items collection.
If I set and then clear the DataSet property to an arbitrary dataset, this problem goes away, but I'm concerned by its presence.
Is adding columns manually in the designer something that I shouldn't be doing? Is there a property I need to set first to make it work without the Dataset set/clear workaround?
Thanks in advance for your help...
Cheers,
Dave.