Gets or sets the caption for this column.
[Visual Basic] Public Property Caption As String [C#] public string Caption {get; set;} [C++] public: __property String* get_Caption(); public: __property void set_Caption(String*); [JScript] public function get Caption() : String; public function set Caption(String);
The caption of the column. If not set, returns the ColumnName value.
The Caption value becomes visible in controls that support its display. For example, the System.WinForms.DataGrid control is capable of displaying captions for each column.
The OnPropertyChanged event occurs when the property is successfully changed.
The following example creates a new DataColumn and adds it to a ColumnsCollection.
[Visual Basic]
Dim myColumn As DataColumn = DataColumn myColumn = New DataColumn("fName") ' Set a different Caption. myColumn.ColumnName = "First Name"
DataColumn Class | DataColumn Members | System.Data Namespace | ColumnName