DataColumn.Caption Proprietà
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene o imposta la didascalia per la colonna.
public:
property System::String ^ Caption { System::String ^ get(); void set(System::String ^ value); };
public string Caption { get; set; }
[System.Data.DataSysDescription("DataColumnCaptionDescr")]
public string Caption { get; set; }
member this.Caption : string with get, set
[<System.Data.DataSysDescription("DataColumnCaptionDescr")>]
member this.Caption : string with get, set
Public Property Caption As String
Didascalia della colonna. Se non impostata, restituisce il valore ColumnName.
- Attributi
Nell'esempio seguente viene creato un nuovo DataTableoggetto . Aggiunge quindi tre DataColumn oggetti a un DataColumnCollection oggetto e imposta la Caption proprietà per ogni DataColumnoggetto .
private void CreateDataTable()
{
DataTable table;
DataColumn column;
table = new DataTable("Customers");
//CustomerID column
column = table.Columns.Add("CustomerID",
System.Type.GetType("System.Int32"));
column.Unique = true;
//CustomerName column
column = table.Columns.Add("CustomerName",
System.Type.GetType("System.String"));
column.Caption = "Name";
//CreditLimit
column = table.Columns.Add("CreditLimit",
System.Type.GetType("System.Double"));
column.DefaultValue = 0;
column.Caption = "Limit";
table.Rows.Add(new object[] {1, "Jonathan", 23.44});
table.Rows.Add(new object[] {2, "Bill", 56.87});
}
Private Sub CreateDataTable()
Dim table As DataTable
Dim column As DataColumn
table = new DataTable("Customers")
'CustomerID column
column = table.Columns.Add( _
"CustomerID", System.Type.GetType("System.Int32"))
column.Unique = True
'CustomerName column
column = table.Columns.Add( _
"CustomerName", System.Type.GetType("System.String"))
column.Caption = "Name"
'CreditLimit
column = table.Columns.Add( _
"CreditLimit", System.Type.GetType("System.Double"))
column.DefaultValue = 0
column.Caption = "Limit"
table.Rows.Add(new object() {1, "Jonathan", 23.44})
table.Rows.Add(new object() {2, "Bill", 56.87})
End Sub
È possibile utilizzare la Caption proprietà per visualizzare un nome descrittivo o descrittivo per un oggetto DataColumn.
Prodotto | Versioni |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
Feedback su .NET
.NET è un progetto open source. Seleziona un collegamento per fornire feedback: