Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Application get hang in VB 6.0

Posted on 2006-11-12
6
Medium Priority
?
205 Views
Last Modified: 2010-04-30
Hello

I have made a application in VB 6.0 which os downloading n number files of from internet. I have put two progress bars in my application first one shows that number of file downloading out of total files, and second progress bar shows that how much percentage of current file has been downloaded. Now everything is going fine. But the problem arise when my form gets deactivate, like i open another application and when i will come back to this is form has become white. When it start to come the title is having (Not Responding) with it. But after some time the files get downloaded this means that the process was working only form stp display. I am thinking that Multithreading can be a better solution for these problem. But i don't know how multithreading can be implemented in VB 6.0 . If anyone can gve better solution then please tell.

Thanx In Advance
Gaurav..
0
Comment
Question by:momentuminfotech
3 Comments
 
LVL 3

Expert Comment

by:herreruud
ID: 17928640
Do you have any events triggered by either "Activate" or "Deactivate" in your form?

If not, I'd say you probably need to add DoEvents in your code. This frees time in your App that will allow windows to (amongst other things) redraw your form.

An example:

Do While Some_Statement

  'Execute some code
  'Execute code to show progress

  DoEvents

Loop
0
 
LVL 11

Accepted Solution

by:
Dany Balian earned 1000 total points
ID: 17932763
i agree with herreruud on the doevents in the loop...

if u dont want to do doevents on every loop

u can try something like

do while some_statement
i=i+1

if i mod 10=0 then doevents
loop


one more thing you can try is to add the following on the form_Activate:
me.refresh


hope this helps,

cheers

dan
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17934802
Hi momentuminfotech,

You need to put:

DoEvents
Me.Refresh

After updating the progress bars.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses

824 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