(Not Responding)

I used search but was unable to find the answer to my question. What i am trying to do is to make my progress bar show my status in my Windows based application. To give some program background, i am writing an update program that will convert all information from the old program's .cad(txt) files to a new MSDatabase. The update works correctly, but due to the lentgh of time it is taking we are trying to add a progress bar or a list box to display our current progress in the update. The program form has 1 button for each item (ie. "Pen Numbers" button - max 14 buttons) so we were able to test each function without running the entire program. Each *single function* button calles its related subroutine. We have a "Run All" button that simply calles all subroutines. Here is a sample of some of the code from the "Run All" button:

ProgressBar1.Minimum = 0
ProgressBar1.Maximum = 14
ProgressBar1.Value = 0

lstcomplete.Text = ""
Call PenNumber()
lstcomplete.Items.Add("Pen Numbers")
lstcomplete.Refresh()
ProgressBar1.Value = ProgressBar1.Value + 1
Call Diagnostic()
lstcomplete.Items.Add("Diagnostic")
lstcomplete.Refresh()
ProgressBar1.Value = ProgressBar1.Value + 1
Call CustomerInfo()
lstcomplete.Items.Add("Customer Info")
lstcomplete.Refresh()
ProgressBar1.Value = ProgressBar1.Value + 1
Call Medication()
lstcomplete.Items.Add("Medication Info")
lstcomplete.Refresh()
ProgressBar1.Value = ProgressBar1.Value + 1

So on and so forth. There are a total of 14 different subroutines that are called. There is a list box on the form called lstcomplete. In theory, after each subroutine is completed the progress bar should reflect as well as a message appear in the list box that will show which subroutines have been run. This code does get called and does function properly but one problem still remains. The last group of data that i uploaded was around 100,000 records long from mulitple text files. Since there is so much information the program itself gives the (Not Responding) while it is doing all of the calculations which is preventing the lstcomplete from updating with our current standing. I put in a progress bar during one of the subroutines and it did prevent the form from going into (Not Responding). I tried putting it on the main form in hopes that it would keep it active so that the messages could be displayed. This has not worked however. I have also tried putting the lstcomplete.items.add at the bottom of each subroutine as well but to no avail. With so many records, we need a way to keep tack of where we are in the program during our testing to make certain that everything is working correctly and we do not enter and endless loop, etc.

Any help that anyone is able to give would be very appreciated! Like i said we do not *need* both the progress bar and the list box to work at the same time, but we need at least one of them and are hoping for the list box.


Answer this question

(Not Responding)

  • finny525

    This article might help. Also try googling for "+backgroundworker +sample"



  • larspl

    Call System.Windows.Forms.DoEvents() to keep your GUI updated. Or consider using the BackgroundWorker component, designed for just such an application.



  • sadmick

    Thank you so much for the reply and suggestion! I have been working with and looking into the BackgroundWorker and have concluded that it is exactally what i need to use. The only problem now is i have NO idea how to use it and get it set up. The examples and F1 information are helping me none as it tells me to call this and put this in and add this but gives no difinitive answer as to how to set it up and use it and what each part is for. Can you give me some help on how to get one of these set up and used in the scenario that i am currently trying to develop

  • (Not Responding)