Get reference to Combobox in Datagridview

H

hvj

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
 
L

Leon Mayne

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)
 
H

hvj

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top