PC Review


Reply
Thread Tools Rate Thread

DataGrid UpperCase and Sort

 
 
=?Utf-8?B?Q2FybWVu?=
Guest
Posts: n/a
 
      20th May 2004
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.
 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      21st May 2004
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.


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
datagrid sort - 3 col in file - 2 col in datagrid - fails? AWW Microsoft VB .NET 1 13th Dec 2008 09:23 PM
RE: DataGrid: how to make DataGrid sort manually? =?Utf-8?B?VFQgKFRvbSBUZW1wZWxhZXJlKQ==?= Microsoft C# .NET 0 15th Apr 2005 04:15 PM
Force UpperCase in DataGrid OHM Microsoft VB .NET 7 11th May 2004 09:01 AM
Need Help Determining DataGrid Column Selected for Sort using IBindingList - Datagrid.zip (0/1) David Elliott Microsoft Dot NET Framework Forms 1 18th Jul 2003 02:22 AM
Need Help Determining DataGrid Column Selected for Sort using IBindingList - Datagrid.zip (0/1) David Elliott Microsoft Dot NET Framework Forms 0 18th Jul 2003 02:12 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:42 AM.