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 3268
Try calling Application.DoE vents 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*********@di scussions.micro soft.com> wrote in message
news:F7******** *************** ***********@mic rosoft.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*********@di scussions.micro soft.com> wrote in message
news:F7******** *************** ***********@mic rosoft.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*********@di scussions.micro soft.com> wrote in message
news:F7******** *************** ***********@mic rosoft.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.DoE vents();
also i built a Thread Class
class ThreadClass
{
public ThreadClass(str ing mydata....etc){//I initialized my data}
public void Process(){//Do my work}
}
in main form function=> didi
ThreadClass oclass = new ThreadClass(pas s params)
Thread oTh = new Thread(new ThreadStart(ocl ass.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*********@di scussions.micro soft.com> wrote in message news:F7******** *************** ***********@mic rosoft.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.DoE vents.
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*********@di scussions.micro soft.com> wrote in message
news:E6******** *************** ***********@mic rosoft.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.DoE vents(); also i built a Thread Class
class ThreadClass { public ThreadClass(str ing mydata....etc){//I initialized my data} public void Process(){//Do my work} }
in main form function=> didi ThreadClass oclass = new ThreadClass(pas s params) Thread oTh = new Thread(new ThreadStart(ocl ass.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*********@di scussions.micro soft.com> wrote in message news:F7******** *************** ***********@mic rosoft.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*********@di scussions.micro soft.com> wrote in message news:F7******** *************** ***********@mic rosoft.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*********@di scussions.micro soft.com> wrote in message
news:E3******** *************** ***********@mic rosoft.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(o bject sender, System.EventArg s e)
{
System.Threadin g.Thread newThread =
new System.Threadin g.Thread(new
System.Threadin g.ThreadStart(t his.CreateBitma p));
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.PerformSte p();
percent = (((y*1.00)/pBar.Maximum)*1 00);
this.label1.Tex t = "Completed: " + Math.Ceiling(pe rcent).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 like we see when copying of files is being done.
is that done by showing some animated gif? If an animated gif then how to
display an animated gif on a form.
|
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 picture so it takes time.. I want to show
a loading messeage there until the Newpage loads.. Anyone got any ideas ?
Thnks
Coskun
|
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 show it on a different then
main thread on my application, this new form became focused, but I want that
new form at the beginning acts like just stay-on-top notification… also in
this form I would like have controls, that could be focused,...
|
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) Then
SaveText(f.txtInput.Text)
End If
|
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 and prerender
events occur, but it is never displayed.
In the super simple example, I use the "hide panel", then click the "Do
Process". The next thing I see is the "done". Why won't the panel
display?
Here is the code:
|
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. The properties
look the same whether I use XP or 2003 versions of Office.
If I take an earlier version of Access and link the image, it puts the
image. I can also see the image in 2003. If I link the image using
2003 it only shows the filename....
|
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 two which would obviously be the best thing. What's the best way therefore to accomplish this? Would a meta-refresh do the trick or would that simply redirect to the thankyou page without processing? Thanks for your help....
|
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 initializing the database, setting variables, setting up the GPS, etc.
That is why I want the form to display first,so that when my routines (in the form load event) run, I want the label to update with text such as "Initializing the database".
...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |