Solved

VB.Net - Wait Cursor and FormDialog

Posted on 2013-05-21
7
844 Views
Last Modified: 2013-05-23
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
Comment
Question by:Jimbo99999
  • 4
  • 3
7 Comments
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 39184469
Try adding application.DoEvents after you set the cursor.
0
 

Author Comment

by:Jimbo99999
ID: 39184928
Thank you responding.  I have done as you suggested but unfortunately no hourglass.  Wow, I can't figure this one out.
0
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 39185936
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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

Author Comment

by:Jimbo99999
ID: 39187362
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
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 39188511
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
 

Author Comment

by:Jimbo99999
ID: 39188868
Using just Cursor.current.
0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 39189241
You can ignore it then, it's only a warning.
0

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question