Hi Carmen,
This I did make some weeks ago as sample for OHM
I now placed the sort in it, the sample table has only one column the
first, for a for column table you would take the right columnname.
I hope it helps as well for you?
Cor
\\\\
Private WithEvents dtbCol1 As DataGridTextBox
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
'This is for the sample datatable
Dim dt As New DataTable("Cor")
Dim dc As New DataColumn("OHM")
dt.Columns.Add(dc)
For i As Integer = 0 To 11
dt.Rows.Add(dt.NewRow)
dt.Rows(i)(0) = ""
Next
'Here start the grid part
Dim ts As New DataGridTableStyle
ts.MappingName = dt.TableName
Dim column As New DataGridTextBoxColumn
ts.GridColumnStyles.Add(column)
DataGrid1.TableStyles.Add(ts)
column = CType(ts.GridColumnStyles(0), DataGridTextBoxColumn)
dtbCol1 = DirectCast(column.TextBox, DataGridTextBox)
column.MappingName = dt.Columns(0).ColumnName
column.HeaderText = "OHM"
dim dv as new dataview(dt)
dv.sort = "OHM"
DataGrid1.DataSource = dv
End Sub
Private Sub dtbCol1_TextChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles dtbCol1.TextChanged
DirectCast(sender, TextBox).Text = StrConv(DirectCast(sender, _
TextBox).Text, vbUpperCase)
End Sub
///
There are more cases you can use.