Combo Box Cell problem

Progress2007

Active member
Joined
Sep 5, 2008
Messages
25
Programming Experience
1-3
Hi i ahve a dataGridView which has some columns. Wht i want if user select a cell then that cell should be convert to combobox cell and we can bind it to a datasource , with display member and value meber.

i ahve wrtten some code for this.

Dim l_ComboCell As New DataGridViewComboBoxCell
Dim l_rowPosition = dgvReport.CurrentCellAddress.X
Dim l_colPosition = dgvReport.CurrentCellAddress.Y

l_ComboCell.DataSource = l_tempTableView
l_ComboCell.DisplayMember = "GroupName"
l_ComboCell.ValueMember = "GroupNumber"

Now my prob is that when i select a value from this combo box , after sletein the value it is displaying the Group number instead on GroupName.

how can i do this
 
You're going about this all wrong. You should simply add a combo box column to the grid. That way every cell is automatically a combo box cell and you simply bind the data to the column. If you don't want each cell to look like a ComboBox until the user selects it then you can configure that in the column properties. You might want to take a look at [ame="http://www.vbforums.com/showthread.php?t=541476"]this[/ame].
 
Back
Top