Question:
Visual Studio .NET Threading problem?
Boldbayar S
2009-01-28 18:59:56 UTC
I am developing an application in Visual Studio .NET 2008. And I have a problem with threading, in other words cross threading.
In my application there is a big process takes few minutes.
When running my application and clicking Start button my application gets unrespondable state, like freezed /but not freezed/ within few minutes.
I want to show the process is in progress with loading image or progress bar until process ends.
How to solve this problem?
Three answers:
[Ninlar]
2009-01-28 19:13:39 UTC
I wrote program that loaded a large XML data file at startup and processed it building up a large Tree View on a background thread. I sub-classed or derived the Thread class and added an event to it called ReportProgress. My main dialog had an event handler to the ReportProgress event. This event would be fired by the background thread and report back what percentage of the data file had been processed. Then I would update the progress bar in that event handler. If the user wanted to perform an operation that required the data file be completely loaded, I would show a modal dialog with the progress bar and they would have to wait for it to complete. In order to do this in that dialog, I would check to see if the thread was still alive. If it was, then the main thread would sleep for 100 milliseconds and check again. This prevented the application from looking unresponsive. On thing to note is that UI objects have to be modified from the main thread with the message loop. You might have to use Invoke to update the progress bar from a background thread. Invoke marshals the call to the main thread.
2016-11-13 03:00:01 UTC
i attempted your cyber web internet site with the login internet site and the registration internet site. indoors the the two the pages, it returns an same errors message as you have pronounced. It says that, the guy interface will not be able to be created for this reason of fact the path is faulty. As you have uploaded your cyber web internet site at as at present as out of your seen studio, the sq. database will by no potential be created. The sq. database is a seperate checklist like putting on your web hosting used to get the archives mutually as an guy or woman registers. on the time of login, the database could be checked for an same username and password. interior the progression that your sq. database isn't created, then registration could be incomplete. be wide awake that, the database checklist could be different from the main cyber web internet site information indoors the checklist supervisor. To create your new database, bypass on your cyber web internet site Cpanel. additionally, the sector call like username or password on your registration type could want to adventure the database field names. mutually as you're truly no longer accustomed to sq. database, please learn some database arising academic on cyber web till now arising the only on your Cpanel. you will hit upon database academic via way of in fact making a glance for on google. mutually as you're be particular that the database is already created indoors the server or you have manually created, then learn the coding indoors the registration type. the path and touch of your database could want to adventure the decision of your database indoors the server you have created. make confident that the path to the database with the web hosting server is likewise suitable. As you have uploaded at as at present as from seen studio, the coding could be in accordance on your guy or woman computers direction like (C:/preparation/databasename or something like this). you will want to regulate the path with the server database direction and the database call. attempt doing the above 2 steps and your errors could be resolved.
nookkin
2009-01-28 19:04:01 UTC
Use a BackgroundWorker to run the CPU-intensive task.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...