Initializes a new instance of the DataGridColumn class with the specified DataColumn.
[Visual Basic] Overloads Public Sub New( _ ByVal prop As PropertyDescriptor _ ) [C#] public DataGridColumn( PropertyDescriptor prop ); [C++] public: DataGridColumn( PropertyDescriptor* prop ); [JScript] public function DataGridColumn( prop : PropertyDescriptor );
When you create an instance of a DataGridColumn, the following read/write properties are initialized.
Property | Initial Value |
---|---|
Alignment | HorizontalAlignment.Left |
AlternatingBackColor | System.Drawing.Color.Empty |
BackColor | System.Drawing.Color.Empty |
DataGridTable | a null reference (in Visual Basic Nothing) |
Font | a null reference (Nothing) |
FontHeight | -1 |
ForeColor | System.Drawing.Color.Empty |
ForeColor | a null reference (Nothing) |
Header | An empty string (""). |
Invalidate | false |
NullText | "(null)" |
ReadOnly | false |
The following example creates a variable for a DataGridColumn and sets the variable to an existing column in the TBD control using a specified DataColumn.
[Visual Basic]
Private Sub SetDataGridColumnByColumn() Dim dc As DataColumn Dim dgc As DataGridColumn ' Set the DataColumn variable. Set dc = DataGrid1.DataGridTable.DataTable.Columns("Fname") ' Set the DataGridColumn variable using the DataColumn reference. Set dgc = DataGrid1.GridColumns(dc) ' Confirm it's the same column by printing the ColumnName. Debug.Print dgc.DataColumn.ColumnName End Sub
DataGridColumn Class | DataGridColumn Members | System.WinForms Namespace | DataGridColumn Constructor Overload List | DataColumn