Home All Groups Group Topic Archive Search About
Author
15 Dec 2006 4:46 AM
juzzy
I'm trying to set the value of a combo box in an unbound DataGridView.

Some code is as follows.

Dim dgr As New DataGridViewRow
dgr.CreateCells(grdBuildingComponents) 'set row with design time column
structure

dgr.Cells(0).Value = dr(0)
dgr.Cells(1).Value = rowcount
dgr.cells(2).value = ?

....where dgr.cells(2) is defined as a combobox through the designer.

How do i set the value of the combo and get the text to display?
Also, when changed, how do I retrieve the value of the combo?

Basic stuff I'm sure but this has me a bit stumped...

Author
15 Dec 2006 5:45 AM
Cor Ligthert [MVP]
Juzzy,

It seems that you are using a datarow, wherefore dr stends in a way as it is
not described. Than why do you want to use an unbound datagrid. At least I
will never do it and put not any minute in it how to do that.

Cor

Show quoteHide quote
"juzzy" <ju***@discussions.microsoft.com> schreef in bericht
news:4DC1D5B9-F69A-4E08-A3D8-8881F7A75792@microsoft.com...
> I'm trying to set the value of a combo box in an unbound DataGridView.
>
> Some code is as follows.
>
> Dim dgr As New DataGridViewRow
> dgr.CreateCells(grdBuildingComponents) 'set row with design time column
> structure
>
> dgr.Cells(0).Value = dr(0)
> dgr.Cells(1).Value = rowcount
> dgr.cells(2).value = ?
>
> ...where dgr.cells(2) is defined as a combobox through the designer.
>
> How do i set the value of the combo and get the text to display?
> Also, when changed, how do I retrieve the value of the combo?
>
> Basic stuff I'm sure but this has me a bit stumped...