I have form with progress bar ,when application begin processing and progress
bar moving if I minimized the form and try to restore it ,it is not showing
until the processing completed ,how can I enabled minimize, maximize moving
form while processing in underway? 8 3252
Try calling Application.DoEvents from within the loop of your long process.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com... I have form with progress bar ,when application begin processing and progress bar moving if I minimized the form and try to restore it ,it is not showing until the processing completed ,how can I enabled minimize, maximize moving form while processing in underway?
Alternatively, run the long process on a thread other than the UI thread.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com... I have form with progress bar ,when application begin processing and progress bar moving if I minimized the form and try to restore it ,it is not showing until the processing completed ,how can I enabled minimize, maximize moving form while processing in underway?
Hi,
Create a thread and do the processing in that thread, you then have the UI
thread to react as usual, to update the progressbar you have two options,
you can use a timer to update it, or if your process is interactive ( like
a loop ) you could send an event to the UI ( using Control.Invoke ) at the
start of each iteration, you could pass info regarding the status or for
example what file you are processing, etc
post back if you need some code, I should have some instances around here.
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com... I have form with progress bar ,when application begin processing and progress bar moving if I minimized the form and try to restore it ,it is not showing until the processing completed ,how can I enabled minimize, maximize moving form while processing in underway?
I did the bother Approches as Bob Said and you also , but i do not know i
think i did something wrong first i tried to call Application.DoEvents();
also i built a Thread Class
class ThreadClass
{
public ThreadClass(string mydata....etc){//I initialized my data}
public void Process(){//Do my work}
}
in main form function=> didi
ThreadClass oclass = new ThreadClass(pass params)
Thread oTh = new Thread(new ThreadStart(oclass.Process));
oTh.Start();
oTh.Join();
but still can not move,maximize the form???any suggestion
"Ignacio Machin ( .NET/ C# MVP )" wrote: Hi,
Create a thread and do the processing in that thread, you then have the UI thread to react as usual, to update the progressbar you have two options, you can use a timer to update it, or if your process is interactive ( like a loop ) you could send an event to the UI ( using Control.Invoke ) at the start of each iteration, you could pass info regarding the status or for example what file you are processing, etc
post back if you need some code, I should have some instances around here.
cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message news:F7**********************************@microsof t.com...I have form with progress bar ,when application begin processing and progress bar moving if I minimized the form and try to restore it ,it is not showing until the processing completed ,how can I enabled minimize, maximize moving form while processing in underway?
Hi,
If you are using a thread you have no need to call Application.DoEvents.
First of all, you HAVE to remove the call to Join() it will block the UI
thread
Now a silly question: How do you increment the progressbar?
I think you have two options:
1- use a timer in the UI thread right after you create your now thread and
before.
2- fire an event from the worker thread as I suggested before.
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message
news:E6**********************************@microsof t.com... I did the bother Approches as Bob Said and you also , but i do not know i think i did something wrong first i tried to call Application.DoEvents(); also i built a Thread Class
class ThreadClass { public ThreadClass(string mydata....etc){//I initialized my data} public void Process(){//Do my work} }
in main form function=> didi ThreadClass oclass = new ThreadClass(pass params) Thread oTh = new Thread(new ThreadStart(oclass.Process)); oTh.Start(); oTh.Join();
but still can not move,maximize the form???any suggestion
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,
Create a thread and do the processing in that thread, you then have the UI thread to react as usual, to update the progressbar you have two options, you can use a timer to update it, or if your process is interactive ( like a loop ) you could send an event to the UI ( using Control.Invoke ) at the start of each iteration, you could pass info regarding the status or for example what file you are processing, etc
post back if you need some code, I should have some instances around here.
cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message news:F7**********************************@microsof t.com... >I have form with progress bar ,when application begin processing and >progress > bar moving if I minimized the form and try to restore it ,it is not > showing > until the processing completed ,how can I enabled minimize, maximize > moving > form while processing in underway?
ok what should i do to make thread working other thank Join()
I increment the progress bar using PerformStep()
first i set the value as the number of file will be processed, then do call
PerformStep
"Ignacio Machin ( .NET/ C# MVP )" wrote: Hi,
Create a thread and do the processing in that thread, you then have the UI thread to react as usual, to update the progressbar you have two options, you can use a timer to update it, or if your process is interactive ( like a loop ) you could send an event to the UI ( using Control.Invoke ) at the start of each iteration, you could pass info regarding the status or for example what file you are processing, etc
post back if you need some code, I should have some instances around here.
cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message news:F7**********************************@microsof t.com...I have form with progress bar ,when application begin processing and progress bar moving if I minimized the form and try to restore it ,it is not showing until the processing completed ,how can I enabled minimize, maximize moving form while processing in underway?
"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message
news:E3**********************************@microsof t.com... ok what should i do to make thread working other thank Join()
It will be scheduled to start as soon as you call Thread.Start()
I increment the progress bar using PerformStep() first i set the value as the number of file will be processed, then do call PerformStep
In this case you should fire an event from the thread each time a new file
is going to be processed. Let me dig around and see if I have an example
that does exactly that. you could also search in google this has been
answered before
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Hi!
I have had the same problem to you, Read. Thanks all who gave here all
the clues. I thought that you, Read, possibly would like to see see the
solution i did thanks to these clues.
Here is my code (to make it more clear I removed not very important
code):
private void button1_Click(object sender, System.EventArgs e)
{
System.Threading.Thread newThread =
new System.Threading.Thread(new
System.Threading.ThreadStart(this.CreateBitmap));
newThread.Start();
}
private void CreateBitmap()
{
pBar.Minimum = 1;
pBar.Maximum = bmp.Height;
pBar.Value = 1;
pBar.Step = 1;
int y;
double percent ;
for(y=0; y < bmp.Height;y++)
{
// do your work
pBar.PerformStep();
percent = (((y*1.00)/pBar.Maximum)*100);
this.label1.Text = "Completed: " + Math.Ceiling(percent).ToString()
+ " %";
}
}
Cheers!
*** Sent via Developersdex http://www.developersdex.com *** This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Noor |
last post by:
Hi All
How some application shows animation to show if some progress/processing is
going on.
like especially in the end of some wizard, the application shows animation
on a form, animation...
|
by: Coskun Cavusoglu |
last post by:
Hi,
What I want to know is when a user clicks on a button I send him to another
page by using the Response.Redirect("") method. But the page that the user
is being sent to has to generate a...
|
by: Krzysztof Karnicki |
last post by:
I would like develop Form on my Windows Application, that is going to notify
the user, just like Microsoft Office 2003 shows that there are new mail
coming. When I use System.Windows.Forms.Form and...
|
by: Mika M |
last post by:
Hi!
If Windows Form -application has for example a button on Form1 which
Click-event opens other Form2-form like...
Dim f as New Form2
f.ShowDialog()
If (f.DialogResult = DialogResult.OK)...
|
by: Dzemo |
last post by:
I want to show some form with animated gif on it (Form1) while some data are
processed in background in application. I use
dim x as new Form1
x.show
for I=0 to 1000000
processing data
next I
|
by: Larry R |
last post by:
I am trying to set a panel (that holds a progress image) to be visible
when a long running process is happening. Sounds simple, right :) What
happens is the panel never becomes visible. The load...
|
by: needin4mation |
last post by:
Hi, I have an Access 2002 - 2003 database. I am using Access 2003.
Whenever I link an image all it shows is the filename. Not the image.
Other versions of Access can link the image just fine. ...
|
by: Luongo |
last post by:
Hi, I have a form that, when submitted, needs to be processed by one file (survey.php) but have another page (thankyou.php) displayed. Because I don't have access to the former, I can't combine the...
|
by: rb0135 |
last post by:
Hi,
I am writing a C# mobile 6 (dot.net 3.5) application.
On the form, I have a label. I update this label with text as my initalizing routines are running (from the form load event), such as...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |