How to set datagrid' textbox columns' max length ?

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

I need to limit the number of characters in the Textbox column in the
datagrid.
How can I do that ?
Thanks
 
Agnes,

Did you see my sample of the column in the language.vb group.

This is almost the same sample however in another way, there is also the
limitation of the textboxcolumn in.

I hope this helps?

Cor

\\\
Private Sub Form7_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim dt As New DataTable("Agnes")
dt.Columns.Add("Cor")
For i As Integer = 0 To 4
Dim dr As DataRow = dt.NewRow
dr(0) = (i + 1).ToString
dt.Rows.Add(dr)
Next
Dim dv As New DataView(dt)
Me.DataGrid1.DataSource = dv
Dim ts As New DataGridTableStyle
ts.MappingName = "Agnes"
Dim column As New DataGridTextBoxColumn
column.TextBox.MaxLength = 4
column.MappingName = "Cor"
column.HeaderText = "Ident"
column.NullText = String.Empty
ts.GridColumnStyles.Add(column)
DataGrid1.TableStyles.Add(ts)
End Sub
///
 
Back
Top