473,473 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

datagrid sort cursor

I have a datagridview that allows the user to sort the column by clicking on
the header of the column the user wishes to sort. I did not code this, it
had the ability when the datagrid was populated. My question is how can I
change the cursor to an hourglass when the user clicks the header and change
it back to the default once the sort is accomplished. The database is large
and the sort takes a few seconds. Need something to show the user the
program is working so the user does not continue to click the header.

Thanks,

Thomas

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Nov 21 '05 #1
2 2903
Hi,

In the mousedown event on the datagrid check and see if the use clicked on
the column header and change the cursor.

Private Sub DataGrid1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DataGrid1.Click

Dim pt As Point = DataGrid1.PointToClient(Cursor.Position)

Dim hti As DataGrid.HitTestInfo = DataGrid1.HitTest(pt)

If hti.Type = DataGrid.HitTestType.ColumnHeader Then

' Change cursor here

End If

End Sub

Here is how to know when the grid was sorted. Change the cursor back after
it was sorted.

http://www.windowsformsdatagridhelp....0-7a5dcc005f84

Ken
-----------------------------
<th*****@msala.net> wrote in message
news:42***********************@news.newsdemon.com. ..
I have a datagridview that allows the user to sort the column by clicking on
the header of the column the user wishes to sort. I did not code this, it
had the ability when the datagrid was populated. My question is how can I
change the cursor to an hourglass when the user clicks the header and change
it back to the default once the sort is accomplished. The database is large
and the sort takes a few seconds. Need something to show the user the
program is working so the user does not continue to click the header.

Thanks,

Thomas

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Nov 21 '05 #2

I failed to mention I am using VB2005. I changed your code a little to work
in 05, but I can't find a listchanged event to use to know when to go back
to the default cursor.

Do you have a suggestion for that?

Thanks,

Thomas

Private Sub DataGridView1_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseDown

Dim myHitTest As System.Windows.Forms.DataGridView.HitTestInfo
' Use the DataGrid control's HitTest method with the x and y properties.
myHitTest = DataGridView1.HitTest(e.X, e.Y)

If myHitTest.Type = DataGridViewHitTestType.ColumnHeader Then
Me.Cursor = System.Windows.Forms.Cursors.WaitCursor
End If
End Sub

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: xrow | last post by:
Hello I have a simple webservice / c# application that receives data from server and prints the data in the asp:datagrid control I have problem when sorting data in datagrid I have created...
0
by: thomasp | last post by:
I have a datagridview that allows the user to sort the column by clicking on the header of the column the user wishes to sort. I did not code this, it had the ability when the datagrid was...
3
by: JJ | last post by:
I have a datagrid on my form that displays its data from various tables within a specified dataset. That all works correclty. However, when one cell is selected prior to changed the displayed...
0
by: crferguson | last post by:
I've been looking in every place I can to find a solution for this and I believe I've pieced a solid one together so I thought I'd share since I've found so much help on these groups... This is...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.