Home Forums WinForms controls Xceed Grid for WinForms ValueMember in bound ComboBox Reply To: ValueMember in bound ComboBox

User (Old forums)
Member
Post count: 23064

Sorry one more question: I am in another part of code, where I have access to a particular row. I just want to set the value of the ComboBox in that row from a string.

AFAIK the only way I can access the relevant combobox is like this:

 row.Cells[“TheColumnWithTheComboBox”].EnterEdit();

WinComboBox MyCombo = row.Cells[“TheColumnWithTheComboBox”].CellEditorControl as WinComboBox;

 

The EnterEdit call is causing an ArgumentException to be thrown:

” The specified cell cannot be the current cell because it does not belong to the grid. Parameter name: CurrentCell”

 What does this mean? Why can’t I just set the displayed value to be whatever I want?

I also tried just setting directly:

 row.Cells[“TheColumnWithTheComboBox”].Value = newValue;

 which gets set OK, but it doesn’t get reflected on the screen, it still shows the first item of the combobox.

 EDIT: Setting Value works OK, problem was me. Still curious about the exception though.

Imported from legacy forums. Posted by Nigel (had 520 views)