DataGridTextBoxColumn Class
Hosts a TextBox control in a cell of a DataGridColumnStyle for editing strings.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
System::MarshalByRefObject
System.ComponentModel::Component
System.Windows.Forms::DataGridColumnStyle
System.Windows.Forms::DataGridTextBoxColumn
| Name | Description | |
|---|---|---|
![]() | DataGridTextBoxColumn() | Initializes a new instance of the DataGridTextBoxColumn class. |
![]() | DataGridTextBoxColumn(PropertyDescriptor^) | Initializes a new instance of a DataGridTextBoxColumn with a specified PropertyDescriptor. |
![]() | DataGridTextBoxColumn(PropertyDescriptor^, Boolean) | Initializes a new instance of the DataGridTextBoxColumn class using the specified PropertyDescriptor. Specifies whether the DataGridTextBoxColumn is a default column. |
![]() | DataGridTextBoxColumn(PropertyDescriptor^, String^) | Initializes a new instance of a DataGridTextBoxColumn with the specified PropertyDescriptor and format. |
![]() | DataGridTextBoxColumn(PropertyDescriptor^, String^, Boolean) | Initializes a new instance of the DataGridTextBoxColumn class with a specified PropertyDescriptor and format. Specifies whether the column is the default column. |
| Name | Description | |
|---|---|---|
![]() | Alignment | Gets or sets the alignment of text in a column.(Inherited from DataGridColumnStyle.) |
![]() | CanRaiseEvents | Gets a value indicating whether the component can raise an event.(Inherited from Component.) |
![]() | Container | Gets the IContainer that contains the Component.(Inherited from Component.) |
![]() | DataGridTableStyle | Gets the DataGridTableStyle for the column.(Inherited from DataGridColumnStyle.) |
![]() | DesignMode | |
![]() | Events | |
![]() | FontHeight | Gets the height of the column's font.(Inherited from DataGridColumnStyle.) |
![]() | Format | Gets or sets the character(s) that specify how text is formatted. |
![]() | FormatInfo | Gets or sets the culture specific information used to determine how values are formatted. |
![]() | HeaderAccessibleObject | This API supports the product infrastructure and is not intended to be used directly from your code. Gets the AccessibleObject for the column.(Inherited from DataGridColumnStyle.) |
![]() | HeaderText | Gets or sets the text of the column header.(Inherited from DataGridColumnStyle.) |
![]() | MappingName | Gets or sets the name of the data member to map the column style to.(Inherited from DataGridColumnStyle.) |
![]() | NullText | Gets or sets the text that is displayed when the column contains null.(Inherited from DataGridColumnStyle.) |
![]() | PropertyDescriptor | Gets or sets the PropertyDescriptor for the DataGridTextBoxColumn.(Overrides DataGridColumnStyle::PropertyDescriptor.) |
![]() | ReadOnly | Sets a value indicating whether the text box column is read-only.(Overrides DataGridColumnStyle::ReadOnly.) |
![]() | Site | |
![]() | TextBox | Gets the hosted TextBox control. |
![]() | Width | Gets or sets the width of the column.(Inherited from DataGridColumnStyle.) |
| Name | Description | |
|---|---|---|
![]() | AlignmentChanged | Occurs when the Alignment property value changes.(Inherited from DataGridColumnStyle.) |
![]() | Disposed | |
![]() | FontChanged | Occurs when the column's font changes.(Inherited from DataGridColumnStyle.) |
![]() | HeaderTextChanged | Occurs when the HeaderText property value changes.(Inherited from DataGridColumnStyle.) |
![]() | MappingNameChanged | Occurs when the MappingName value changes.(Inherited from DataGridColumnStyle.) |
![]() | NullTextChanged | Occurs when the NullText value changes.(Inherited from DataGridColumnStyle.) |
![]() | PropertyDescriptorChanged | Occurs when the PropertyDescriptor property value changes.(Inherited from DataGridColumnStyle.) |
![]() | ReadOnlyChanged | Occurs when the ReadOnly property value changes.(Inherited from DataGridColumnStyle.) |
![]() | WidthChanged | Occurs when the Width property value changes.(Inherited from DataGridColumnStyle.) |
| Name | Description | |
|---|---|---|
![]() ![]() | IDataGridColumnStyleEditingNotificationService::ColumnStartedEditing(Control^) | Informs the DataGrid control that the user has begun editing the column.(Inherited from DataGridColumnStyle.) |
The DataGridTextBoxColumn class derives from the abstract class DataGridColumnStyle. At run time, the DataGridTextBoxColumn hosts a DataGridTextBox control that allows users to edit text.
Special properties added to the class include Format, and HideEditBox. These properties allow you to access the hosted DataGridTextBox control and its attributes, and set the format for displaying values.
If the data source is a DataTable containing DataColumn objects, the DataType property of the DataColumn should be set to a data type that can logically be edited in a text box control. The following data types are automatically associated with a DataGridTextBoxColumn : Byte, DateTime, Decimal, Double, Int16, Int32, Int64, UInt16, UInt32, UInt64, Single, and String.
[Visual Basic]
The following example creates a DataGridTextBoxColumn and adds it to the GridColumnStylesCollection of a DataGrid. To run this code example, paste it into a form that has a DataGrid named dataGrid1 and call it from the constructor of the Form.
private: void AddColumn() { DataTable^ myTable = gcnew DataTable; // Add a new DataColumn to the DataTable. DataColumn^ myColumn = gcnew DataColumn( "myTextBoxColumn" ); myColumn->DataType = System::Type::GetType( "System::String" ); myColumn->DefaultValue = "default string"; myTable->Columns->Add( myColumn ); // Get the CurrencyManager for the DataTable. CurrencyManager^ cm = dynamic_cast<CurrencyManager^>(this->BindingContext[ myTable ]); // Use the CurrencyManager to get the PropertyDescriptor for the new column. System::ComponentModel::PropertyDescriptor^ pd = cm->GetItemProperties()[ "myTextBoxColumn" ]; DataGridTextBoxColumn^ myColumnTextColumn; // Create the DataGridTextBoxColumn with the PropertyDescriptor. myColumnTextColumn = gcnew DataGridTextBoxColumn( pd ); // Add the new DataGridColumn to the GridColumnsCollection. dataGrid1->DataSource = myTable; dataGrid1->TableStyles->Add( gcnew DataGridTableStyle ); dataGrid1->TableStyles[ 0 ]->GridColumnStyles->Add( myColumnTextColumn ); }
Available since 1.1
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.







