tags:

views:

29

answers:

2

hello,

how can I add a link to DataGridViewLinkColumn?Here is my code:

Dim linkColumn As New DataGridViewLinkColumn linkColumn.Name = "Links" dgv.Columns.Add(linkColumn) dgv.Rows.Add("URL", "TEXT")

What is the code for "URL" and "LINKTEXT"?

A: 

To display the same link text for every cell, set the UseColumnTextForLinkValue property to true and set the Text property to the desired link text.

Try this.

Private Sub AddLinkColumn()

    Dim links As New DataGridViewLinkColumn()
    With links
        .UseColumnTextForLinkValue = True
        .HeaderText = ColumnName.ReportsTo.ToString()
        .DataPropertyName = ColumnName.ReportsTo.ToString()
        .ActiveLinkColor = Color.White
        .LinkBehavior = LinkBehavior.SystemDefault
        .LinkColor = Color.Blue
        .TrackVisitedState = True
        .VisitedLinkColor = Color.YellowGreen
    End With
    DataGridView1.Columns.Add(links)
End Sub
Carter
A: 

And where can I insert the URL?

vb.net