DataColumn.Caption 속성

정의

열의 캡션을 가져오거나 설정합니다.

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

속성 값

열의 캡션입니다. 설정하지 않은 경우 ColumnName 값이 반환됩니다.

특성

예제

다음 예제에서는 새 DataTable를 만듭니다. 그런 다음 에 세 개의 DataColumn 개체를 DataColumnCollection 추가하고 각 DataColumnCaption 대한 속성을 설정합니다.

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

설명

사용할 수 있습니다는 Caption 속성에 대 한 설명 또는 식별 이름을 표시 합니다 DataColumn.

적용 대상

추가 정보