473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

C# Screen not Refreshing during long process

I have a Simple Windows Form which I placed a button and when the button is
pressed it proceses data into a database and I update the task bar for each
record.
The task bar would show processing 1 of 200 and so on...

The problem is if I click anyware on my form during this process it locks
and I cant do anything with that form.( my process keeps running but the form
stops updateing)
Now if I dont touch the form. its happy and my task bar updates ok.

How can I keep this from happening?
I was told to use a Thread but im not sure how to this.
Can I do someing like
Thread.Start();
My process runs...
Thread.stop();

Any Ideas or can I use something else?
--
Cheers,
Craig C Dallas,TX

Jul 21 '05 #1
3 3161
On simple way is to do it asynchronously and a separate thread is one way.
Another easy way is to create a delegate that matches the signature of the
function you want to call. Then, delcare in instance of the delegate, and
use IAsyncResult ar = delegateName.BeginInvoke();//passing in null for the
addiotional parameters since you probably don't need a callback.
http://www.knowdotnet.com/articles/reponsiveui.html

--
W.G. Ryan, MVP

www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Craig C" <Cr****@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
I have a Simple Windows Form which I placed a button and when the button is pressed it proceses data into a database and I update the task bar for each record.
The task bar would show processing 1 of 200 and so on...

The problem is if I click anyware on my form during this process it locks
and I cant do anything with that form.( my process keeps running but the form stops updateing)
Now if I dont touch the form. its happy and my task bar updates ok.

How can I keep this from happening?
I was told to use a Thread but im not sure how to this.
Can I do someing like
Thread.Start();
My process runs...
Thread.stop();

Any Ideas or can I use something else?
--
Cheers,
Craig C Dallas,TX

Jul 21 '05 #2
On Fri, 29 Oct 2004 12:41:03 -0700, Craig C wrote:

Any Ideas or can I use something else?


I presume your processing occurs in a loop. The quickest, "low tech"
method of resolving your problem is to add a call to Application.DoEvents
to your loop.

This may suit your needs.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Jul 21 '05 #3
Thanks!!! That did the job.
Craig

"Chris Dunaway" <"dunawayc[[at]_lunchmeat" wrote:
On Fri, 29 Oct 2004 12:41:03 -0700, Craig C wrote:

Any Ideas or can I use something else?


I presume your processing occurs in a loop. The quickest, "low tech"
method of resolving your problem is to add a call to Application.DoEvents
to your loop.

This may suit your needs.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Paula | last post by:
Is there a way to keep the browser from refreshing the screen during a post back to the same page? This is annoying when you are viewing something at the bottom of a page an the post refreshes the...
11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
3
by: John Baker | last post by:
Hi: As in the "Wizard of Oz", I want people to "pay no attention to the man behind the curtain", by freezing the screen while a whole lot of things happen. I know about ECHO OFF, but this...
2
by: Art | last post by:
I've got a program that I run -- it's under the control of a form. Part of the process is fairly lengthy (10 minutes). The form has a control that lets me know how far it's gotten. My problem...
3
by: Craig C | last post by:
I have a Simple Windows Form which I placed a button and when the button is pressed it proceses data into a database and I update the task bar for each record. The task bar would show processing 1...
6
by: Br | last post by:
Hi everyone, Another newbie-type question, Here's what I'd like to do: 1) Have a user type something into an input-field 2) Transfer that information into a database 3) Extract that...
6
by: Chris Moore | last post by:
I have a .NET form where I am updating a progress bar & counter. As long as the form never loses focus, everything on the form refreshs fine. But If I open another window (like Windows Explorer)...
2
by: dmartin_1 | last post by:
I'm building an application with Visual Basic 2005. The application is multi threaded. It has a record counter on the form that counts up to completion. It works fine throughout the process as...
2
by: =?Utf-8?B?d2R1ZGVr?= | last post by:
I have a website using windows integrated security, with anonymous access turned off. The site is used to query orders from a database and when the search takes a long time, a windows login box...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
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...
0
jinu1996
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.