DatagridView comboboxcolumn - assign cell value

  • Thread starter Thread starter Bill nguyen
  • Start date Start date
B

Bill nguyen

I need help to set selected value of combobox column in DGV.

I went this far then got stuck on what to do next:.
How do I set "selected Value" of comboboxpayCode to value of column PayCode
? That is earningCode = payCode.
I can't find .selectedValue in DatagridView ComboboxColumn .

Thanks

Bill

-------------------------
col = .Columns.Add("pCode", "Code")

..Columns(col).Width = 60

..Columns(col).DataPropertyName = "payCode"' Dim comboboxPaycode As New
DataGridViewComboBoxColumn()

..Columns.Insert(4, comboboxPaycode)

..Columns(4).Width = 120

..Columns(4).HeaderText = "Code Desc"

With comboboxPaycode

..DataSource = dCombo.Tables(0)

..ValueMember = "earningCode"

..DisplayMember = "codeDescript"



End With
 
Bill,

Your question sounds strange for me, you can have thousands of comboboxes in
your datagrid (as you have thousand rows. Do you mean that they should be
all set to a defaultvalue. If it is a new one than just set the value in the
datarow, so it will be automaticly binded to the corresponding value.

Cor
 
Cor;
I guess my question is not clear. I found the answer to it by setting
..DataPropertyName property

Thanks for your help, as usual.

Bill
 
Back
Top