Datagridview Combobox Cell issue

compguru910

Well-known member
Joined
Nov 25, 2009
Messages
47
Programming Experience
3-5
Ok, so, I have managed to add a datagridview combobox column to my datagridview (which may be the issue). This is what im trying to do

1: Assign the datasource
2: Assign the valuemember and the displaymember
3: Set which of the displayed member is selected by figuring the value in from a cell in the same row as the combo box.

Each row in the dgv has a combobox cell at the very end, and the contents in each of them need to be set to the valuemember of a cell in the same row

I have tried running through a For Each Loop on the datagridview, with no luck. Heres what I tried

VB.NET:
For each dgvCell As DataGridViewComboBoxCell In dgvMain.Rows
     Dim intIndex As Integer
     intIndex = dgvCell.RowIndex
     dgvCell.datasource = statusData
     dgvCell.valuemember = "status_id"
    dgvCell.Displaymember = "description"
     dgvCell.Value = dgvMain.Item(7,intIndex).Value
 Next

This just gives an error. It will run, but wont execute following this loop, telling me its getting stuck. Thanks for the help.
 
Back
Top