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?  
easy_lifeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AgariciCommented:
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

hth,
A.
0
easy_lifeAuthor Commented:
How to implement progress bar in this process? Could you please tell me how to do this?
0
HooKooDooKuCommented:
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.
0
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

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?
0
AgariciCommented:
@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:
http://msdn.microsoft.com/en-us/library/system.windows.forms.progressbar.aspx
http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_23692978.html


regards,
A.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
easy_lifeAuthor Commented:

m_PolarZIP.SourceDirectory = m_ExtendedUPackage.DirectoryName
m_PolarZIP.FilesToProcess = "*.*"
m_PolarZIP.Add()
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?
0
easy_lifeAuthor Commented:

m_PolarZIP.Add()
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?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.