DataGridViewLinkCell.UseColumnTextForLinkValue Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets a value indicating whether the column Text property value is displayed as the link text.
public:
property bool UseColumnTextForLinkValue { bool get(); void set(bool value); };
public bool UseColumnTextForLinkValue { get; set; }
member this.UseColumnTextForLinkValue : bool with get, set
Public Property UseColumnTextForLinkValue As Boolean
Property Value
true
if the column Text property value is displayed as the link text; false
if the cell FormattedValue property value is displayed as the link text. The default is false
.
Examples
The following code example demonstrates the use of the DataGridViewLinkColumn.UseColumnTextForLinkValue property, which is similar to this property. This example is part of a larger example available in the DataGridViewComboBoxColumn class overview topic.
private:
void AddLinkColumn()
{
DataGridViewLinkColumn^ links = gcnew DataGridViewLinkColumn();
links->UseColumnTextForLinkValue = true;
links->HeaderText = ColumnName::ReportsTo.ToString();
links->DataPropertyName = ColumnName::ReportsTo.ToString();
links->ActiveLinkColor = Color::White;
links->LinkBehavior = LinkBehavior::SystemDefault;
links->LinkColor = Color::Blue;
links->TrackVisitedState = true;
links->VisitedLinkColor = Color::YellowGreen;
DataGridView1->Columns->Add(links);
}
private void AddLinkColumn()
{
DataGridViewLinkColumn links = new DataGridViewLinkColumn();
links.UseColumnTextForLinkValue = true;
links.HeaderText = ColumnName.ReportsTo.ToString();
links.DataPropertyName = ColumnName.ReportsTo.ToString();
links.ActiveLinkColor = Color.White;
links.LinkBehavior = LinkBehavior.SystemDefault;
links.LinkColor = Color.Blue;
links.TrackVisitedState = true;
links.VisitedLinkColor = Color.YellowGreen;
DataGridView1.Columns.Add(links);
}
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
Remarks
Setting the UseColumnTextForLinkValue property of the owning column also sets the UseColumnTextForLinkValue property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value.