DataGridViewLinkColumn::UseColumnTextForLinkValue Property
Gets or sets a value indicating whether the Text property value is displayed as the link text.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Property Value
Type: System::Booleantrue if the 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.
| Exception | Condition |
|---|---|
| InvalidOperationException | The value of the CellTemplate property is null. |
Getting or setting this property gets or sets the UseColumnTextForLinkValue property of the object returned by the CellTemplate property. Setting this property 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.
The following code example demonstrates how to set this property so that the FormattedValue property of each cell, in this case the employee ID of the employee's boss, is displayed as the text link. After selecting the link, the selection point is moved to the boss's name. 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); }
Available since 2.0