Progress bar in VB.Net

I am creating zip package for more text files in my project. It almost takes 12 or more seconds to create a zip package. A timer is running behind this process.
My problem is:
                   I need to put a message box stating that it takes more time to create zip package if the creating time is 4 or more seconds. I will give two options to the user "YES" or "NO". If user clicks yes it continues process and show progress bar to complete the process. If user clicks "No", it stops creating zip package.
How to put message box and progress bar in this functionality?  
Who is Participating?
AgariciConnect With a Mentor Commented:
@HooKooDooKu: code execution does not stop. only message processing of the parent window stops. but please note that the modal dialog will still have a message loop and will process messages. also, any other threads (i mean other than the main GUI thread) will continue to work just fine.

@easy_life: life cannot be so easy ;) please check the msdn for how to use the progress bar control:


i suggest you remove the intermediate yes/no dialog and, after the 4 seconds have elapsed, simply display a modal dialog with a progress of some kind, a descriptive text and a cancel button.
this way the user will see from the start all that is needed and, if he wants to abort, will be able to press the cancel dialog.

when you detect that the zip process has terminated, simply close this modal dialog

easy_lifeAuthor Commented:
How to implement progress bar in this process? Could you please tell me how to do this?
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

You don't have to "implement" a progress bar. VB.Net already has a ProgressBar included in the set of common controls.  So just build you a custom form with the progress bar, abort button, and text on it.  Otherwise, the only thing "unusual" is the notion that you provide a short delay before showing the form so that the form never appears for short processes.
However, you many need to NOT use a MODAL dialog box, unless all of this logic is running inside that modal dialog box.  The reason?  Once you show a dialog box modally, code execution stops outside the dialog box until the dialog box is dismissed.
easy_lifeAuthor Commented:
Timer is running behind this creating zip package process.
How can I dynamically set maximum and value properties of progress bar control?
easy_lifeAuthor Commented:

m_PolarZIP.SourceDirectory = m_ExtendedUPackage.DirectoryName
m_PolarZIP.FilesToProcess = "*.*"
This is the code for zipping all files. At this point it takes lot of time so how can I set maximum and value properties of progress bar?
easy_lifeAuthor Commented:

Only this statement takes lot of time to add all file to zip folder so how can I process progress bar while adding files to the zip folder.
Could you please help me with this issue?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.