Link to home
Start Free TrialLog in
Avatar of DavidGreenfield
DavidGreenfieldFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Datagridview - Linklabel


Hi there

Is it possible to create a column in a datagridview where all the cells are shown as link labels?  If so how do I got about this

many thanks!
Avatar of newyuppie
newyuppie
Flag of Ecuador image

the DataGridView allows you to do this already i believe. just right click on the datagridview, edit columns, and set the COlumnType to DataGridViewLinkColumn
Avatar of Kinger247
Kinger247

Set the column type to DataGridViewLinkColumn (for each column).
hi kinger! only 25 more points and you get Master! congrats
Avatar of DavidGreenfield

ASKER

How can I use the datagridviewlinkcolumn with exisitng data?

My data is being loaded form a data table,  and its on one of the columns I want turn into a link label.  I can only find information on adding a column in, not actually using the data thats already there in the table.

Can I not do this?

thanks for your help so far!
when you are in the designer, right click and edit columns in the datagridview. select the column you want to turn into a link label, and navigate the property sheet of that column until you find ColumnType. change that to DataGridViewLinkColumn.

unless you are automatically generating the columns, in which case you must do it by code using something like this:

Dim column As DataGridViewColumn = dataGridView.Columns("Links")
        column.ColumnType = DataGridViewLinkColumn

Hi newyuppie

I am automatically generating the columns,

but the code you gave me does not work.  It says columntype is not a member of datagridviewcolumn.  I have celltype option - but this then errors on datagridviewlinkcolumn saying its not a type and cannot be used as an expression.

thanks foryour help so far!
ASKER CERTIFIED SOLUTION
Avatar of Kinger247
Kinger247

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Kinga, that works perfectly.  Thank you very much indeed!