We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Error in CurrentCellCloseDropDown

Hi, I am using GDBG. For one of the column I have ‘ComboBox’ as cell type. I have attached the code related to the ‘CurrentCellCloseDropDown’ event. Problem: When I am at the very last row of the grid (basically new row which doesn’t have any data) and click the dropdown button for that cell but I don’t select anything from the list. I see the list but don’t select any value from list. After clicking on the dropdown button of the cell I click somewhere else which Triggers the ‘CurrentCellCloseDropDown’ event and I get the following error. Type: System.ArgumentOutOfRangeException Message: Specified argument was out of the range of valid values. Parameter name: Index was out of range. Must be non-negative and less than the size of the collection. Stack Trace: at System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32 index) at FOX.FBC.Planning.PL.PlanningClient.DepartmentBudget.SalaryAdjustmentsUserControl.ValidatePayTypeCode(String& validationMessage) in c:\development\application\fox\fbc\planning\1.0\source\pl\planningclient\departmentbudget\salaryadjustmentsusercontrol.cs:line 880 at FOX.FBC.Planning.PL.PlanningClient.DepartmentBudget.SalaryAdjustmentsUserControl.dgEmployees_CurrentCellCloseDropDown(Object sender, PopupClosedEventArgs e) in c:\development\application\fox\fbc\planning\1.0\source\pl\planningclient\departmentbudget\salaryadjustmentsusercontrol.cs:line 851 at Syncfusion.Windows.Forms.Grid.GridControlBase.OnCurrentCellCloseDropDown(PopupClosedEventArgs e) at Syncfusion.Windows.Forms.Grid.GridControlBase.RaiseCurrentCellCloseDropDown(PopupClosedEventArgs e) at Syncfusion.Windows.Forms.Grid.GridDropDownCellImp.DropDownContainerCloseDropDown(Object sender, PopupClosedEventArgs e) at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.DropDownContainerCloseDropDown(Object sender, PopupClosedEventArgs e) at Syncfusion.Windows.Forms.Grid.GridComboBoxCellRenderer.ChildClosing(IPopupChild childUI, PopupCloseType popupCloseType) at Syncfusion.Windows.Forms.PopupControlContainer.OnCloseUp(PopupClosedEventArgs args) at Syncfusion.Windows.Forms.PopupControlContainer.HidePopup(PopupCloseType popupCloseType) at Syncfusion.Windows.Forms.PopupControlContainer.VeryifyMouseBasedDeactivation(Control destinationControl, Int32 msg) at Syncfusion.Windows.Forms.PopupControlContainer.ProcessMouseMessage(Control destination, Int32 msg) at Syncfusion.Windows.Forms.PopupControlContainer.Syncfusion.Windows.Forms.INeedMouseMoveMessages.MouseMessage(Message& m) at Syncfusion.Windows.Forms.PopupManager.PreFilterMessage(Message& m) Source: mscorlib Please suggest what can I do to prevent this error. Probably I am getting this error due the fact the row is new and I didn’t select from list and trying to validate value in ‘CurrentCellCloseDropDown’ event. Thanks,

code0.zip

2 Replies

ST stanleyj Syncfusion Team January 12, 2006 04:37 PM UTC

Hi Vs, I do not see this error. Just an analyze may help you. If the CurrentCellCloseDropDown be raised as you said in the AddNew row, ValidatePayTypeCode will return true, because cc.Renderer.ControlValue and this.dgEmployees[cc.RowIndex, cc.ColIndex].CellValue are nothing and the are the same, so the statement of execution leaves this block. if(cc.Renderer.ControlValue != this.dgEmployees[cc.RowIndex, cc.ColIndex].CellValue) { } Best regards, Stanley


AD Administrator Syncfusion Team January 13, 2006 01:43 AM UTC

If I commented out the following lines of code from the event then everything is working fine, so it is proven that error is caused by the ValidatePayTypeCode method call. string validationMessage; if (!this.ValidatePayTypeCode(out validationMessage)) { this.dgEmployees.CurrentCell.CancelEdit(); this.dgEmployees.Binder.CancelEdit(); MessageBox.Show(validationMessage); } Please help. Thanks,

Loader.
Live Chat Icon For mobile
Up arrow icon