DataGridTextBoxColumn.TextBox Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets the hosted TextBox control.

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

public virtual TextBox TextBox { get; }

Property Value

Type: System.Windows.Forms.TextBox

A TextBox control hosted by the column.

The following example changes the background color of the hosted TextBox control.

Private Sub SetTextBoxBgColor()
   Dim myGridTextBox As DataGridTextBox
   Dim myColumnTextColumn As DataGridTextBoxColumn
   ' Assumes there is a DataGridTextBoxColumn 
   ' already created in  the DataGrid control.
   myColumnTextColumn = CType(DataGrid1.TableStyles("Customers"). _
   GridColumnStyles("FirstName"), DataGridTextBoxColumn)
   myGridTextBox = CType(myColumnTextColumn.TextBox, _
   ' Change the background color.
   myGridTextBox.BackColor = System.Drawing.Color.Red
End Sub

.NET Framework
Available since 1.1
Return to top