Solved

WinForms not showing

Posted on 2012-03-28
3
130 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 500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Winform Module - What is the ASP.Net equiv 2 39
VB.Net - Not Sure if Multi-threading is What I Need 4 41
Get month and date in a format 4 45
Access/Visual Basic Question 3 42
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 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