Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

DataGridTextBox Class

Represents a TextBox control that is hosted in a DataGridTextBoxColumn.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
[ComVisibleAttribute(true)]
public class DataGridTextBox : TextBox

The DataGridTextBox and the DataGridTextBoxColumn work together so that users can directly edit values in a DataGrid control column. The DataGridTextBoxColumn derives from DataGridColumnStyle, and is designed to host the DataGridTextBox, which derives from the TextBox control.

In addition to the properties, events, and methods of the base control, you can call the KeyPress and KeyDown events with the OnKeyPress and OnMouseDown methods.

The following code example demonstrates how to get the DataGridTextBox hosted by a DataGridTextBoxColumn.

private void GetDataGridTextBox()
{
   // Gets the DataGridTextBoxColumn from the DataGrid control.
   DataGridTextBoxColumn myTextBoxColumn;
   // Assumes the CompanyName column is a DataGridTextBoxColumn.
    myTextBoxColumn = (DataGridTextBoxColumn)dataGrid1.
   TableStyles[0].GridColumnStyles["CompanyName"];
   // Gets the DataGridTextBox for the column.
   DataGridTextBox myGridTextBox;
   myGridTextBox = (DataGridTextBox) myTextBoxColumn.TextBox;
}
System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      System.Windows.Forms.Control
        System.Windows.Forms.TextBoxBase
          System.Windows.Forms.TextBox
            System.Windows.Forms.DataGridTextBox
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.