Combobox in bound DataGridView?

If you need the SelectedValue of the ComboBox to be an index rather than a string, fill the ComboBox with a list of custom objects rathen than a list of strings.

If you need the SelectedValue of the ComboBox to be an index rather than a string, fill the ComboBox with a list of custom objects rathen than a list of strings : dgvComboColumn. DataSource = new { new { Index = 1, Text = "Foo" }, new { Index = 2, Text = "Bar" }, new { Index = 3, Text = "Baz" } }; dgvComboColumn. DisplayMember = "Text"; dgvComboColumn.

ValueMember = "Index"; dgvComboColumn. DataPropertyName = "(the DB column that stores the index).

Fantastic! I was already using a custom object and setting the DisplayMember and ValueMember properies - however, I didn't know about DataPropertyName! That's just solved in one line, what took me hours to hack around!

;-) I knew there must have been an easier way. Thankyou! – Dan May 29 '10 at 23:48.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions