Home All Groups Group Topic Archive Search About

DatagridView comboboxcolumn - assign cell value

Author
27 Jun 2006 4:56 AM
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

Author
27 Jun 2006 7:10 AM
Cor Ligthert [MVP]
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

Show quoteHide quote
"Bill nguyen" <billn_nospam_please@jaco.com> schreef in bericht
news:eV31PYamGHA.1912@TK2MSFTNGP02.phx.gbl...
>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
>
>
Author
27 Jun 2006 1:07 PM
Bill nguyen
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
Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:ep5F6hbmGHA.3752@TK2MSFTNGP02.phx.gbl...
> 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
>
> "Bill nguyen" <billn_nospam_please@jaco.com> schreef in bericht
> news:eV31PYamGHA.1912@TK2MSFTNGP02.phx.gbl...
>>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
>>
>>
>
>