ComboBox column in DataGridView

D

David

This isn't exactly about DataGrid. It's about DataGridView, but I'm hoping
this newsgroup is close enough. I have a ComboBox type column in a
DataGridView. (VS 2005, .Net 2.0 Beta
versions)

This is an unbound column. No datasource, datamember, or valuemember is
defined. The columns all have an item list.

Is there a simple way to get at the selected index of the combobox in a cell
from that column? For a given cell, I want to get at the SelectedIndex
property of the combobox in that cell. As it is, all I can seem to do is get
at the Value property, which will return the corresponding string. Since it
is an unbound column, I don't have any way of associating a DataMember with
the list of items. (Do I?)

So, the only way I can see to do what I want is to retrieve the Value
property, and then compare that to each item in the list until I get a match,
and then return the position in the list from which the Value was found.
(And if there are two identical items, even that wouldn't work.) Can I get
directly at the selected index value in the DataGridViewComboBoxCell if that
column is an unbound column?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top