Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1248
  • Last Modified:

VB.Net - Wait Cursor and FormDialog

Good Day Experts!

I am really quite perplexed with my current issue and hope it is something simple.

I have a Startup form with 3 radio buttons.  The User picks one and hits <GO>.  The code behind the <GO> button is:

If rbtnBatchStatus.Checked = True Then
      BatchStatus.ShowDialog()
ElseIf rbtnRaterStatus.Checked = True Then
      RaterStatus.ShowDialog()
ElseIf rbtnPkgStatus.Checked = True Then
      PkgStatus.ShowDialog()
End If

In the Load_Event of each form I am running queries to load ComboBoxes and DataGrids. So, I have the waitCursor at the top of the Load_Event.  I use the following just like all my other projects:

Me.Cursor = System.Windows.Forms.Cursors.WaitCursor

Then in the Finally part of the Try/Catch I put the following just like all my other projects:

Me.Cursor = System.Windows.Forms.Cursors.Default

My issue is that the cursor never changes to the hourglass which leaves the User wondering.  Granted, the most I have seen was maybe 4-5seconds depending on the volume.  

Do you see any issues with how I am trying to this?

Thanks,
jimbo99999
0
Jimbo99999
Asked:
Jimbo99999
  • 4
  • 3
1 Solution
 
Kyle AbrahamsSenior .Net DeveloperCommented:
Try adding application.DoEvents after you set the cursor.
0
 
Jimbo99999Author Commented:
Thank you responding.  I have done as you suggested but unfortunately no hourglass.  Wow, I can't figure this one out.
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
http://devlicio.us/blogs/derik_whittaker/archive/2006/10/06/How-to-simply-Manage-Cursor-Changing-for-WinForms-Applications.aspx

Remove the DoEvents and do:

'remember current cursor and set wait cursor.
Dim currentCursor as Cursor = Cursor.Current
Cursor.Current = Cursors.WaitCursor

'At end reset
Cursor.Current = currentCursor
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Jimbo99999Author Commented:
Thanks for responding.  It works now.  But there are green lines under "Cursor.Current".
When I hover over it, the message says "Access of shared members, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated".

Is this ok or do I have additional lines of code I need?

Thanks,
jimbo99999
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
are you using me.cursor.current or just cursor.current?

http://bytes.com/topic/visual-basic-net/answers/463398-net-2-0-conversion-wizard-flags-me-cursor

You can ignore the warning but if you're using me.Cursor.Current get rid of the "me."
0
 
Jimbo99999Author Commented:
Using just Cursor.current.
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
You can ignore it then, it's only a warning.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now