Solved

VB.Net - Wait Cursor and FormDialog

Posted on 2013-05-21
7
738 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 39

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 39

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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 39

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 39

Expert Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This video discusses moving either the default database or any database to a new volume.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now