Hi,
I am using UltraComboEditor in a WinGrid. I create the UltraComboEditor in the grid_InitializeRow method. The data is added as a semicolon-separated string. This works fine.
When I check an item in one comboBox of the row, I want to deselect the same item in all other comboboxes of the same row.
I handle this in the combo_ValueChanged event handler, and I tried to handle it also in the grd_CellChange event handler.
I search the other combo boxes by the following cast:
UltraComboEditor cmbSel = grdBalFad.Rows[0].Cells[ind].EditorComponent as UltraComboEditor;
Now I want to uncheck items by calling cmbSel.SetCheckState (items, System.Windows.Forms.CheckState.Unchecked);
The items parameter is a collection of items to uncheck ValueListItems from the cmbSel.Items collection.
I also tried to by changing the CheckState of the ValueListItem in the grd.Items collection.
Nothing changes in the checkstate of the combobox.
I noticed also that the cmbSel.SelectedItems collection is always empty.
Any idea how to solve this problem.
Thanks in advance and kind regards,
Hello,
Could you please review the sample attached to this post and see if it meets your requirements.Please feel free to let me know if I misunderstood you or if you have any other questions.
Hi Boris,
Thanks for the quick response.
I have attached a small sample to demonstrate what I want to achieve.
I have a grid with one row with check comboBoxes in each cell. When a checkstate in one combobox is activated, I want to uncheck the same item in all other comboBoxes. By this way an item can be checked only once in a row.
This will be handled in the CellChange event handler of the grid.
To make it clear, I have added comments in the code.
If you need more info, plees feel free to contact me.
Luc
Hello Luc,
I tried your sample with 'EditorValueSource' set to 'SelectedItem' and it seems to work fine for me. Next step: I changed the body of your condition like this:
if (combo.Items[ind].CheckState == CheckState.Checked) { otherCombo.Items[ind].CheckState = CheckState.Unchecked; }
Please try this approach and get back to me when possible.
Maybe I overlooked something, but I tried your suggestion and it is not working.
I have attached my modified sample.
Can you send me your working sample.
Thanks and kind regards,
I might have forgotten something, but let us not go for the details - I am attaching you my sample.
Please take a look and let me know if something is wrong.
I am checking about the progress of this issue. Please let me know If you need any further assistance on this.