By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,034 Members | 971 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,034 IT Pros & Developers. It's quick & easy.

DataGrid UpperCase and Sort

P: n/a
how to format my datagrid control for only write on it in upper case. Also i want to sort my datagrid control automatically for the column number 4. Any ideas.
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
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?

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")
For i As Integer = 0 To 11
dt.Rows(i)(0) = ""
'Here start the grid part
Dim ts As New DataGridTableStyle
ts.MappingName = dt.TableName
Dim column As New DataGridTextBoxColumn
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.
Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.