Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Hourglass

Status
Not open for further replies.

umeman

Technical User
Oct 2, 2001
59
US
Hi,

I have a VB6 application where I am trying to
change the cursor to an Hourglass while the
application is doing some database processing

I used the following:

Screen.MousePointer = vbHourglass
.. Data base processing code
Screen.MousePointer = vbDefault

However the mouse pointer remains the arrow

Please assist
 
If I put your vbhourglass code in the Form_load event of a vb form, it works. (I'm sure if you tried it, you'd get the same result.) Therefore the code that you have given us is not the problem.

See if you can narrow it down.

HTH

Bob
 
Your code is not reaching the last line OR some other event is being triggered that also sets the hourglass. Simply put a break point on the line of code you do not think is working.
 
Try:
Code:
Screen.MousePointer = vbHourglass
DoEvents
.. Data base processing code
Screen.MousePointer = vbDefault
 
Juice05,

I don't think DoEvents is going to anything.

I would suggest that there is an error somewhere in the database code and that On Error Resume Next is being used.

So that the pointer changes to hourglass but then immediately changes back to the default.

Sound plausible?
 
Or the database code is running through so fast it is not noticeable.
 
Absent further input from the creator of the thread, we'll never know, but andy's assessment seems sound to me.

Bob
 
Hi

To answer a few questions:

The database processing does not error and the process
does run for 15 miniutes. There is no error with the VB code as I am able to step thru the code in debug mode.

Back to my question is there any alternative to
Screen.MousePointer = vbHourglass to change the screen pointer as this code executes but the mouse pointer does not change

Thanks
 
I'm going to hazard a guess that you are running this code with your windows minimized, or perhaps you don't even have a window and are running it from a simple Main routine. Sadly this won't work, as Screen.Mousepointer doesn't do what you think it does on XP, 2000 or 2003: it only changes the pointer when it is over windows belonging to the application that made the call (of course in the IDE the IDE itself is a window belonging to the application and is generally maximised thus giving the impression when debugging that the mousepointer has changed for the entire screen)
 
Ah. I missed something, sorry for being careless. I put Me.MousePointer in my code, you have Screen.MousePointer in yours. So, to answer your question, yes, there is an alternative: use Me.MousePointer. I would think it was preferable to have an hourglass only on your form anyway?

HTH

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top