Machaira Posted February 10, 2003 Posted February 10, 2003 I create a thread when my application starts which performs a query that returns a sizeable number of records. I'm running this in a separate thread to allow the user to use the features of the application that don't require this data. If the user invokes the feature that requires this data I display a message on the status bar and attempt to set the mouse cursor, as follows: Cursor.Current = Cursors.WaitCursor DirectCast(Me.ParentForm, MainForm).StatusMsg("Loading commands, please wait...", False) If tCommandListFormLoadThread.ThreadState = Threading.ThreadState.Running Then tCommandListFormLoadThread.Priority = Threading.ThreadPriority.Highest While tCommandListFormLoadThread.ThreadState = Threading.ThreadState.Running Application.DoEvents() End While End If Cursor.Current = Cursors.Default The only problem is the cursor does not change. :) Any suggestions as to why this might be occuring would be appreciated. [edit]I missed some info in the Help concerning calling DoEvents. :) [/edit] Quote Here's what I'm up to.
Moderators Robby Posted February 10, 2003 Moderators Posted February 10, 2003 One thing that stands out is that you don't need the IF line because you're already doing the While loop. And put a Doevents after the WaitCursor line. Quote Visit...Bassic Software
Machaira Posted February 11, 2003 Author Posted February 11, 2003 The If line is there to set the priority of the thread before entering the loop. As for the DoEvents, that was the problem. Calling DoEvents resets the cursor to the default. Thanks, though. Quote Here's what I'm up to.
Moderators Robby Posted February 11, 2003 Moderators Posted February 11, 2003 "DoEvents resets the cursor to the default" Oh, I can't figure out why. Just to test, place the cursor line in the loop. Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.