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
System.ArgumentException when interacting w/ Column Chooser of disposed grid
posted

I can cause an unhandled ArgumentException if I select a band in the Column Chooser dialog of a grid that has been disposed and released from memory.

Why doesn't the grid close the Column Chooser when the grid's Dispose() method is called?

How can I force the grid to close the Column Chooser?

 

System.ArgumentException:

CurrentBand must be a valid band from the SourceGrid.

Parameter name: CurrentBand

Exception Properties:

ParamName: CurrentBand

 

Stack Trace:

   at Infragistics.Win.UltraWinGrid.UltraGridColumnChooser.set_CurrentBand(UltraGridBand value)

   at Infragistics.Win.UltraWinGrid.UltraGridColumnChooser.comboBoxBandSelector_SelectedIndexChanged(Object sender, EventArgs e)

   at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)

   at System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)

   at System.Windows.Forms.ComboBox.WndProc(Message& m)

   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

Parents
  • 469350
    Offline posted

    Hi,

    I tried this out and I get the same results you describe. Disposing the grid does not close the dialog. That appears to be a bug, so I am going to forward this thread over to Infragistics Developer Support and ask them to create a case for you and write this issue up for developer review so we can get it fixed.

    In the mean time, you can work around this pretty easily by keeping a reference to the dialog and disposing it yourself when the grid is disposed:


            ColumnChooserDialog columnChooserDialog;


            private void ultraGrid1_BeforeColumnChooserDisplayed(object sender, BeforeColumnChooserDisplayedEventArgs e)
            {
                this.columnChooserDialog = e.Dialog;
                this.ultraGrid1.Disposed += new EventHandler(ultraGrid1_Disposed);
            }

            void ultraGrid1_Disposed(object sender, EventArgs e)
            {
                if (this.columnChooserDialog != null)
                {
                    this.columnChooserDialog.Close();
                    this.columnChooserDialog.Dispose();
                    this.columnChooserDialog = null;

                }
            }

     

Reply Children