DataGridTextBoxColumn Class
Hosts a TextBox control in a cell of a DataGridColumnStyle for editing strings.
System::MarshalByRefObject
System.ComponentModel::Component
System.Windows.Forms::DataGridColumnStyle
System.Windows.Forms::DataGridTextBoxColumn
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The DataGridTextBoxColumn type exposes the following members.
| 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 | Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.) |
![]() | Events | Gets the list of event handlers that are attached to this Component. (Inherited from Component.) |
![]() | 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 | Infrastructure. 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 nullptr. (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 | Gets or sets the ISite of the Component. (Inherited from Component.) |
![]() | TextBox | Gets the hosted TextBox control. |
![]() | Width | Gets or sets the width of the column. (Inherited from DataGridColumnStyle.) |
| Name | Description | |
|---|---|---|
![]() | Abort | Initiates a request to interrupt an edit procedure. (Overrides DataGridColumnStyle::Abort(Int32).) |
![]() | BeginUpdate | Suspends the painting of the column until the EndUpdate method is called. (Inherited from DataGridColumnStyle.) |
![]() | CheckValidDataSource | Throws an exception if the System.Windows.Forms::DataGrid does not have a valid data source, or if this column is not mapped to a valid property in the data source. (Inherited from DataGridColumnStyle.) |
![]() | ColumnStartedEditing | Informs the System.Windows.Forms::DataGrid that the user has begun editing the column. (Inherited from DataGridColumnStyle.) |
![]() | Commit | Inititates a request to complete an editing procedure. (Overrides DataGridColumnStyle::Commit(CurrencyManager, Int32).) |
![]() | ConcedeFocus | Informs the column that the focus is being conceded. (Overrides DataGridColumnStyle::ConcedeFocus().) |
![]() | CreateHeaderAccessibleObject | Gets the AccessibleObject for the column. (Inherited from DataGridColumnStyle.) |
![]() | CreateObjRef | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.) |
![]() | Dispose() | Releases all resources used by the Component. (Inherited from Component.) |
![]() | Dispose(Boolean) | Releases the unmanaged resources used by the Component and optionally releases the managed resources. (Inherited from Component.) |
![]() | Edit(CurrencyManager, Int32, Rectangle, Boolean) | Prepares a cell for editing. (Inherited from DataGridColumnStyle.) |
![]() | Edit(CurrencyManager, Int32, Rectangle, Boolean, String) | Prepares the cell for editing using the specified CurrencyManager, row number, and Rectangle parameters. (Inherited from DataGridColumnStyle.) |
![]() | Edit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean) | Prepares a cell for editing. (Overrides DataGridColumnStyle::Edit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean).) |
![]() | EndEdit | Ends an edit operation on the DataGridColumnStyle. |
![]() | EndUpdate | Resumes the painting of columns suspended by calling the BeginUpdate method. (Inherited from DataGridColumnStyle.) |
![]() | EnterNullValue | Enters a Value in the column. (Overrides DataGridColumnStyle::EnterNullValue().) |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.) |
![]() | GetColumnValueAtRow | Gets the value in the specified row from the specified CurrencyManager. (Inherited from DataGridColumnStyle.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | GetMinimumHeight | Gets the height of a cell in a DataGridColumnStyle. (Overrides DataGridColumnStyle::GetMinimumHeight().) |
![]() | GetPreferredHeight | Gets the height to be used in for automatically resizing columns. (Overrides DataGridColumnStyle::GetPreferredHeight(Graphics, Object).) |
![]() | GetPreferredSize | Returns the optimum width and height of the cell in a specified row relative to the specified value. (Overrides DataGridColumnStyle::GetPreferredSize(Graphics, Object).) |
![]() | GetService | Returns an object that represents a service provided by the Component or by its Container. (Inherited from Component.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | HideEditBox | Hides the DataGridTextBox control and moves the focus to the DataGrid control. |
![]() | InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | Invalidate | Redraws the column and causes a paint message to be sent to the control. (Inherited from DataGridColumnStyle.) |
![]() | MemberwiseClone() | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.) |
![]() | Paint(Graphics, Rectangle, CurrencyManager, Int32) | Paints the a DataGridColumnStyle with the specified Graphics, Rectangle, CurrencyManager, and row number. (Overrides DataGridColumnStyle::Paint(Graphics, Rectangle, CurrencyManager, Int32).) |
![]() | Paint(Graphics, Rectangle, CurrencyManager, Int32, Boolean) | Paints a DataGridColumnStyle with the specified Graphics, Rectangle, CurrencyManager, row number, and alignment. (Overrides DataGridColumnStyle::Paint(Graphics, Rectangle, CurrencyManager, Int32, Boolean).) |
![]() | Paint(Graphics, Rectangle, CurrencyManager, Int32, Brush, Brush, Boolean) | Paints a DataGridColumnStyle with the specified Graphics, Rectangle, CurrencyManager, row number, Brush, and foreground color. (Overrides DataGridColumnStyle::Paint(Graphics, Rectangle, CurrencyManager, Int32, Brush, Brush, Boolean).) |
![]() | PaintText(Graphics, Rectangle, String, Boolean) | Draws the text and rectangle at the given location with the specified alignment. |
![]() | PaintText(Graphics, Rectangle, String, Brush, Brush, Boolean) | Draws the text and rectangle at the specified location with the specified colors and alignment. |
![]() | ReleaseHostedControl | Removes the reference that the DataGrid holds to the control used to edit data. (Overrides DataGridColumnStyle::ReleaseHostedControl().) |
![]() | ResetHeaderText | Resets the HeaderText to its default value, nullptr. (Inherited from DataGridColumnStyle.) |
![]() | SetColumnValueAtRow | Sets the value in a specified row with the value from a specified CurrencyManager. (Inherited from DataGridColumnStyle.) |
![]() | SetDataGrid | Sets the System.Windows.Forms::DataGrid control that this column belongs to. (Inherited from DataGridColumnStyle.) |
![]() | SetDataGridInColumn | Adds a TextBox control to the DataGrid control's Control::ControlCollection. (Overrides DataGridColumnStyle::SetDataGridInColumn(DataGrid).) |
![]() | ToString | Returns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from Component.) |
![]() | UpdateUI | Updates the user interface. (Overrides DataGridColumnStyle::UpdateUI(CurrencyManager, Int32, String).) |
| Name | Description | |
|---|---|---|
![]() | AlignmentChanged | Occurs when the Alignment property value changes. (Inherited from DataGridColumnStyle.) |
![]() | Disposed | Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.) |
![]() | 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 | 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 ); }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
