DataGridTextBoxColumn Class
TOC
Collapse the table of content
Expand the table of content

DataGridTextBoxColumn Class

 

Hosts a TextBox control in a cell of a DataGridColumnStyle for editing strings.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      System.Windows.Forms.DataGridColumnStyle
        System.Windows.Forms.DataGridTextBoxColumn

public class DataGridTextBoxColumn : DataGridColumnStyle

NameDescription
System_CAPS_pubmethodDataGridTextBoxColumn()

Initializes a new instance of the DataGridTextBoxColumn class.

System_CAPS_pubmethodDataGridTextBoxColumn(PropertyDescriptor)

Initializes a new instance of a DataGridTextBoxColumn with a specified PropertyDescriptor.

System_CAPS_pubmethodDataGridTextBoxColumn(PropertyDescriptor, Boolean)

Initializes a new instance of the DataGridTextBoxColumn class using the specified PropertyDescriptor. Specifies whether the DataGridTextBoxColumn is a default column.

System_CAPS_pubmethodDataGridTextBoxColumn(PropertyDescriptor, String)

Initializes a new instance of a DataGridTextBoxColumn with the specified PropertyDescriptor and format.

System_CAPS_pubmethodDataGridTextBoxColumn(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.

NameDescription
System_CAPS_pubpropertyAlignment

Gets or sets the alignment of text in a column.(Inherited from DataGridColumnStyle.)

System_CAPS_protpropertyCanRaiseEvents

Gets a value indicating whether the component can raise an event.(Inherited from Component.)

System_CAPS_pubpropertyContainer

Gets the IContainer that contains the Component.(Inherited from Component.)

System_CAPS_pubpropertyDataGridTableStyle

Gets the DataGridTableStyle for the column.(Inherited from DataGridColumnStyle.)

System_CAPS_protpropertyDesignMode

Gets a value that indicates whether the Component is currently in design mode.(Inherited from Component.)

System_CAPS_protpropertyEvents

Gets the list of event handlers that are attached to this Component.(Inherited from Component.)

System_CAPS_protpropertyFontHeight

Gets the height of the column's font.(Inherited from DataGridColumnStyle.)

System_CAPS_pubpropertyFormat

Gets or sets the character(s) that specify how text is formatted.

System_CAPS_pubpropertyFormatInfo

Gets or sets the culture specific information used to determine how values are formatted.

System_CAPS_pubpropertyHeaderAccessibleObject

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.)

System_CAPS_pubpropertyHeaderText

Gets or sets the text of the column header.(Inherited from DataGridColumnStyle.)

System_CAPS_pubpropertyMappingName

Gets or sets the name of the data member to map the column style to.(Inherited from DataGridColumnStyle.)

System_CAPS_pubpropertyNullText

Gets or sets the text that is displayed when the column contains null.(Inherited from DataGridColumnStyle.)

System_CAPS_pubpropertyPropertyDescriptor

Gets or sets the PropertyDescriptor for the DataGridTextBoxColumn.(Overrides DataGridColumnStyle.PropertyDescriptor.)

System_CAPS_pubpropertyReadOnly

Sets a value indicating whether the text box column is read-only.(Overrides DataGridColumnStyle.ReadOnly.)

System_CAPS_pubpropertySite

Gets or sets the ISite of the Component.(Inherited from Component.)

System_CAPS_pubpropertyTextBox

Gets the hosted TextBox control.

System_CAPS_pubpropertyWidth

Gets or sets the width of the column.(Inherited from DataGridColumnStyle.)

NameDescription
System_CAPS_protmethodAbort(Int32)

Initiates a request to interrupt an edit procedure.(Overrides DataGridColumnStyle.Abort(Int32).)

System_CAPS_protmethodBeginUpdate()

Suspends the painting of the column until the EndUpdate method is called.(Inherited from DataGridColumnStyle.)

System_CAPS_protmethodCheckValidDataSource(CurrencyManager)

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.)

System_CAPS_protmethodColumnStartedEditing(Control)

Informs the System.Windows.Forms.DataGrid that the user has begun editing the column.(Inherited from DataGridColumnStyle.)

System_CAPS_protmethodCommit(CurrencyManager, Int32)

Inititates a request to complete an editing procedure.(Overrides DataGridColumnStyle.Commit(CurrencyManager, Int32).)

System_CAPS_protmethodConcedeFocus()

Informs the column that the focus is being conceded.(Overrides DataGridColumnStyle.ConcedeFocus().)

System_CAPS_protmethodCreateHeaderAccessibleObject()

Gets the AccessibleObject for the column.(Inherited from DataGridColumnStyle.)

System_CAPS_pubmethodCreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodDispose()

Releases all resources used by the Component.(Inherited from Component.)

System_CAPS_protmethodDispose(Boolean)

Releases the unmanaged resources used by the Component and optionally releases the managed resources.(Inherited from Component.)

System_CAPS_protmethodEdit(CurrencyManager, Int32, Rectangle, Boolean)

Prepares a cell for editing.(Inherited from DataGridColumnStyle.)

System_CAPS_protmethodEdit(CurrencyManager, Int32, Rectangle, Boolean, String)

Prepares the cell for editing using the specified CurrencyManager, row number, and Rectangle parameters.(Inherited from DataGridColumnStyle.)

System_CAPS_protmethodEdit(CurrencyManager, Int32, Rectangle, Boolean, String, Boolean)
System_CAPS_protmethodEndEdit()

Ends an edit operation on the DataGridColumnStyle.

System_CAPS_protmethodEndUpdate()

Resumes the painting of columns suspended by calling the BeginUpdate method.(Inherited from DataGridColumnStyle.)

System_CAPS_protmethodEnterNullValue()

Enters a Value in the column.(Overrides DataGridColumnStyle.EnterNullValue().)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection.(Inherited from Component.)

System_CAPS_protmethodGetColumnValueAtRow(CurrencyManager, Int32)

Gets the value in the specified row from the specified CurrencyManager.(Inherited from DataGridColumnStyle.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodGetMinimumHeight()

Gets the height of a cell in a DataGridColumnStyle.(Overrides DataGridColumnStyle.GetMinimumHeight().)

System_CAPS_protmethodGetPreferredHeight(Graphics, Object)

Gets the height to be used in for automatically resizing columns.(Overrides DataGridColumnStyle.GetPreferredHeight(Graphics, Object).)

System_CAPS_protmethodGetPreferredSize(Graphics, Object)

Returns the optimum width and height of the cell in a specified row relative to the specified value.(Overrides DataGridColumnStyle.GetPreferredSize(Graphics, Object).)

System_CAPS_protmethodGetService(Type)

Returns an object that represents a service provided by the Component or by its Container.(Inherited from Component.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodHideEditBox()

Hides the DataGridTextBox control and moves the focus to the DataGrid control.

System_CAPS_pubmethodInitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodInvalidate()

Redraws the column and causes a paint message to be sent to the control.(Inherited from DataGridColumnStyle.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodPaint(Graphics, Rectangle, CurrencyManager, Int32)
System_CAPS_protmethodPaint(Graphics, Rectangle, CurrencyManager, Int32, Boolean)
System_CAPS_protmethodPaint(Graphics, Rectangle, CurrencyManager, Int32, Brush, Brush, Boolean)
System_CAPS_protmethodPaintText(Graphics, Rectangle, String, Boolean)

Draws the text and rectangle at the given location with the specified alignment.

System_CAPS_protmethodPaintText(Graphics, Rectangle, String, Brush, Brush, Boolean)

Draws the text and rectangle at the specified location with the specified colors and alignment.

System_CAPS_protmethodReleaseHostedControl()

Removes the reference that the DataGrid holds to the control used to edit data.(Overrides DataGridColumnStyle.ReleaseHostedControl().)

System_CAPS_pubmethodResetHeaderText()

Resets the HeaderText to its default value, null.(Inherited from DataGridColumnStyle.)

System_CAPS_protmethodSetColumnValueAtRow(CurrencyManager, Int32, Object)

Sets the value in a specified row with the value from a specified CurrencyManager.(Inherited from DataGridColumnStyle.)

System_CAPS_protmethodSetDataGrid(DataGrid)

Sets the System.Windows.Forms.DataGrid control that this column belongs to.(Inherited from DataGridColumnStyle.)

System_CAPS_protmethodSetDataGridInColumn(DataGrid)
System_CAPS_pubmethodToString()

Returns a String containing the name of the Component, if any. This method should not be overridden.(Inherited from Component.)

System_CAPS_protmethodUpdateUI(CurrencyManager, Int32, String)

NameDescription
System_CAPS_pubeventAlignmentChanged

Occurs when the Alignment property value changes.(Inherited from DataGridColumnStyle.)

System_CAPS_pubeventDisposed

Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)

System_CAPS_pubeventFontChanged

Occurs when the column's font changes.(Inherited from DataGridColumnStyle.)

System_CAPS_pubeventHeaderTextChanged

Occurs when the HeaderText property value changes.(Inherited from DataGridColumnStyle.)

System_CAPS_pubeventMappingNameChanged

Occurs when the MappingName value changes.(Inherited from DataGridColumnStyle.)

System_CAPS_pubeventNullTextChanged

Occurs when the NullText value changes.(Inherited from DataGridColumnStyle.)

System_CAPS_pubeventPropertyDescriptorChanged

Occurs when the PropertyDescriptor property value changes.(Inherited from DataGridColumnStyle.)

System_CAPS_pubeventReadOnlyChanged

Occurs when the ReadOnly property value changes.(Inherited from DataGridColumnStyle.)

System_CAPS_pubeventWidthChanged

Occurs when the Width property value changes.(Inherited from DataGridColumnStyle.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIDataGridColumnStyleEditingNotificationService.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]

System_CAPS_noteNote

The following types are not fully supported by Visual Basic: DateTime, UInt16, UInt32, UInt64, and TimeSpan. (Operators are not allowed.)

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= new DataTable();

     // Add a new DataColumn to the DataTable.
     DataColumn myColumn = new 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 = (CurrencyManager)this.BindingContext[myTable];
     // Use the CurrencyManager to get the PropertyDescriptor for the new column.
     PropertyDescriptor pd = cm.GetItemProperties()["myTextBoxColumn"];
     DataGridTextBoxColumn myColumnTextColumn;
     // Create the DataGridTextBoxColumn with the PropertyDescriptor.
     myColumnTextColumn = new DataGridTextBoxColumn(pd);
     // Add the new DataGridColumn to the GridColumnsCollection.
     dataGrid1.DataSource= myTable;
     dataGrid1.TableStyles.Add(new DataGridTableStyle());
     dataGrid1.TableStyles[0].GridColumnStyles.Add(myColumnTextColumn);
 }

.NET Framework
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.

Return to top
Show:
© 2016 Microsoft