System.Data Namespace DataColumn Class
Sets or retrieves the caption for the column.
Script |
DataColumn.Caption [ = strCaption ] |
strCaption |
The caption of the column. If not set, returns the ColumnName value. |
The property is read/write with no default value.
The Caption value becomes visible in controls that support its display. For example, the System.Windows.Forms.DataGrid control is capable of displaying captions for each column.
The following example initializes a new DataColumn and adds it to a DataColumnCollection.
private void SetCaption ( ) {
DataColumn myColumn = new DataColumn ( "fName" );
// set a different Caption.
myColumn.Caption = "First Name";
}
Private Sub SetCaption ( )
Dim myColumn As New DataColumn ( "fName" )
' set a different Caption.
myColumn.Caption = "First Name"
End Sub |
|
C# |
VB |
DataColumn Members ColumnName