Solved

Easy question

Posted on 2000-05-04
6
167 Views
Last Modified: 2011-09-20
How do I make it so that when a user click on btnSave,

The cursor turns into an hourglass
and nothing else can be done while save is in progress.

Thanks
0
Comment
Question by:sopheak
6 Comments
 
LVL 5

Expert Comment

by:AnswerTheMan
ID: 2779165
Screen.MousePointer=vbHourGlass
0
 
LVL 5

Expert Comment

by:AnswerTheMan
ID: 2779166
to release :
Screen.MousePointer=vbDefault
0
 

Author Comment

by:sopheak
ID: 2779181
I tried it, but I can still click on other buttons (even with the hourglas cursor) while the save is in progress.  Am I missing something?

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 69

Accepted Solution

by:
Éric Moreau earned 50 total points
ID: 2779199
Just turning the mouse pointer doesn't stop user from clicking elsewhere.

You can use this:

Private Sub Command1_Click()
Dim dtmstart As Date

Screen.MousePointer = vbHourglass
Me.Enabled = False

'Simulate some process
dtmstart = Now
Do Until DateAdd("s", 15, dtmstart) < Now
    DoEvents
Loop

Me.Enabled = True
Screen.MousePointer = vbDefault
Beep
End Sub
0
 

Author Comment

by:sopheak
ID: 2779209
Thanks, that was it
0
 

Expert Comment

by:maxwseven
ID: 2779211
I usually do this to deal with that problem :

 I don't know how heavy your application is but, I usually put all my buttons on a container
( Ex. PictureBox ).

Then put the picturebox without border and the correct BackColor so that you can not tell that there is a picturebox on the form. When the "Save" is in progress, put the picturebox like so :

 MousePointer = vbHourGlass
 Picture1.enabled = false
 
 'Job...
 'Job...
 'Job...
 'Job finished

 Picture1.enabled = true
 Mousepointer = vbDefault

 OK !

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

759 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

21 Experts available now in Live!

Get 1:1 Help Now