From: hvj on
Hi all,

I'm stuck on the following seemingly easy issue?

When I know the row nr and column nr of a cell in a datagridview with
a combobox in it how do I get a reference to that combobox?

Help would be very much appreciated.

Regards,
Henk
From: Leon Mayne on
hvj(a)paralax.nl wrote:
> Hi all,
>
> I'm stuck on the following seemingly easy issue?
>
> When I know the row nr and column nr of a cell in a datagridview with
> a combobox in it how do I get a reference to that combobox?
>
> Help would be very much appreciated.
>
> Regards,
> Henk

Something like (for row 1, column 2):

Dim ddlYourDropDown As DropDownList =
CType(CType(Me.GridView1.Controls(0),
Table).Rows(1).Cells(2).FindControl("ddlYourDropDown"), DropDownList)
From: hvj on
On 25 jul, 13:47, Leon Mayne <leon.rm...(a)mvps.org> wrote:
> h...(a)paralax.nl wrote:
> > Hi all,
>
> > I'm stuck on the following seemingly easy issue?
>
> > When I know the row nr and column nr of  a cell in a datagridview with
> > a combobox in it how do I get a reference to that combobox?
>
> > Help would be very much appreciated.
>
> > Regards,
> > Henk
>
> Something like (for row 1, column 2):
>
> Dim ddlYourDropDown As DropDownList =
> CType(CType(Me.GridView1.Controls(0),
> Table).Rows(1).Cells(2).FindControl("ddlYourDropDown"), DropDownList)

Thanks for the try Leon, but gridview1.Controls does not contain
something that can be cast to Table. In my case it only contains the
scrollbars.

I found out that there isn't even a edit control for every cell. Not
until some cell gets in the editmode an edit control is instantiated.
And with dataGridview.EditingControl it can be retreived.