I have a DGV(unbound) with many Columns and one of the Column is ComboBoxColumn. I want to add Items in it whenever user enters in the First column. This I am able to do on CellValueChange Event . i.e. if Cell Value of Index 1 changes then 3related Items (say A,B &C) are added to combo of Comboboxcolumn and item at 0 Index (A) is set as default selection, and before adding these items I am clearing the Combobox. Please note that Items to be added in combo may be different in different rows, e.g. maybe in 2nd Row Combo 3related Items may be say A,D &F. After adding some data , if User want to EDIT the selection done in Combobox in any row then user will directly enter in that Combobox column. So to take care of it I am taking help of CellBeginEdit Event to Load the 3 Items related to Column1 Item of that Particular Row. Loading is successful. Now issue comes if user changes the selection in combobox by directly entering in the combobox Column, it gives error “system.argumentexception: datagridviewcomboboxCell value not Valid” My Best guess is it due to different ItemSets of combo in different rows. What may be the solution, any suggestions?
Asked
Active
Viewed 17 times