?
Solved

WinForms not showing

Posted on 2012-03-28
3
Medium Priority
?
132 Views
Last Modified: 2013-02-12
I have an application that I designed in VB.net.  What I am trying to do is upon clicking the exit button in my application I want another WIndows Form to show and perform my "backup procedure".  The situation is the backup procedure works and takes about15 seconds to complete.  However the form does not show up.  The main form just stays on the screen, and then after the backup conmpletes the program exits (which is what it is supposed to do upon completion of backup procedure).  

I want the backup form to show while it is doing the backup procedure because there is a progress bar on there that I want to display, of course, the progress of the backup.  How can I get the form to display without just executing tyhe code and not showing the form?  I have a frmBackup.SHOW and I have tried frmBackup.ShowDialog() but nothing shows the form.  It is loading because the form contains the backup procedure and it is running.

Any help is greatly appreciated.
0
Comment
Question by:JasonJasonJasonJason
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 37780313
Sounds like you need to move the actual backup code into another thread.  The BackgroundWorker() control is the easiest way to do this.

If you have a long running loop, however, you might be able to get away with simply placing Application.DoEvents() inside that loop.
0
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37780526
Move the entire backup code to this new form, add progress bar in this form and add a backgroundworker to start backup in background.

Here is an example on how to use backgroundworker and progressbar together:-
http://www.dotnetperls.com/progressbar
http://www.codeproject.com/Tips/83317/BackgroundWorker-and-ProgressBar-demo

Don't let the form return until the job is complete.
Also open this form on form_closing event of your parent form in frmBackup.ShowDialog();
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 1500 total points
ID: 37781613
Good suggestions above. If you move the backup code from Form.Load event to Form.Shown event, you form will show before the backup code executes. But for the progressbar to work, you would need to do some multithreading/backgroundworker.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

765 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