|
-
Jun 25th, 2000, 11:39 PM
#1
Thread Starter
Member
I am having a problem with my form. When I run the program (which does SQL queries on a Jet dbase) it lists in the Task Manager as Not Responding, and the form doesn't refresh (if you open something else and then come back to the form none of the form stuff, redraws.) However, when the code finally finishes the form refreshes. How do I make it stop listing as Not Responding and refresh?
-
Jun 25th, 2000, 11:42 PM
#2
Try placing DoEvents in your code.
-
Jun 26th, 2000, 12:07 AM
#3
Thread Starter
Member
How would I use DoEvents? Put it at the beginning of the cmdButton_Click event?
-
Jun 26th, 2000, 12:36 AM
#4
Addicted Member
Hi,
I don't know if this will help in your case, but in the Form_Activate() use the Recordset.Requery statement before your main code, and that way you will refresh the data environment when the form shows.
GRAHAM
-
Jun 26th, 2000, 01:29 AM
#5
DoEvents
DoEvents commands are usually put inside loops. They give the operating system the chance to do things like repaint the screen that they might not otherwise get the chance to do in a tight loop.
-
Jun 26th, 2000, 02:06 AM
#6
Thread Starter
Member
My program doesn't use any major loops where a lot of processing occurs. Is there somewhere else I can put the DoEvent statement. Also will I just put DoEvent on its own line, or do I need to assign a variable: MyVar=DoEvent?
Thanks for the help guys.
-
Jun 26th, 2000, 02:10 AM
#7
It's DoEvents and it goes on its own line. If a loop isn't the problem then do a Ctrl-Break when the program isn't responding, take a look at where it is and put the DoEvents there.
-
Jun 26th, 2000, 02:30 AM
#8
I would think that you should place it in your loop that causes the delay.
-
Jun 26th, 2000, 02:32 AM
#9
Thread Starter
Member
Thanks for all the help guys, I'll try it.
-
Jun 26th, 2000, 02:42 AM
#10
Thread Starter
Member
One last thing, does DoEvent work for everything after it?
For example I've got this code in a Click event:
funcFunction1
funcFunction2...etc
If I put DoEvent before the first function call, will it work for all the functions after it?
-
Jun 26th, 2000, 03:29 AM
#11
No, DoEvents is just a temporary "pause" that let's the operating system do some work.
-
Jun 26th, 2000, 04:44 AM
#12
Thread Starter
Member
-
Jun 26th, 2000, 04:53 AM
#13
Lively Member
The pause caused by a DoEvents command is not really noticeable. Your problem may have more to do with an SQL query which is taking a long time to return control to your application. Is the database you're querying normalized? If you send a query to a large table, your query will appear to freeze the system.
-
Jun 26th, 2000, 05:05 AM
#14
transcendental analytic
the pause depends what threads windows system is executing on it, you may in worst case wait 10 mins, but thats highly unlikely to happen. usually it takes less than a millisecond.
You can use it in a loop with gettickcount api and you will have a dealy
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 26th, 2000, 05:37 AM
#15
Thread Starter
Member
They are fairly long queries. Is there anyway around this, or do I just have to live with it? Which is fine since it's not for districution
-
Jun 26th, 2000, 06:07 AM
#16
transcendental analytic
Well that depends on the system, the end users system but if it's for you and you have a problems with it you have to live with it or get a new one.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 26th, 2000, 07:01 AM
#17
Lively Member
Can the database you're querying be normalized any more than it is? Querying a small table rather than a large one will save a great deal of time.
-
Jun 26th, 2000, 07:54 PM
#18
Thread Starter
Member
No, I've already tried to break it into the smallest pieces possible before doing anything major to them. Again thanks for all your help guys.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|