Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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]

Here's what I'm up to.
Posted

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.

Here's what I'm up to.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...