Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 5th, 2004, 09:48 AM
Authorized User
 
Join Date: Jun 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to Refresh a Windows Form in C#

Hi,
I have a Windows form application that has a start button, a progress bar and also writes information to the status bar the code is C#. My problem is that when you hit the start button and the program executes then the application window does not get refreshed so you just see an ugly gray rectangle until the application ends. The status and progress bar do get updated but still if you toggle to another application and then toggle back to the Windows form application the contents of the Windows form is not refreshed. I want to have the Windows form to refresh (or redraw) itself say every second or have an event like a mouse over event refresh the window.
Any ideas on how I can implement this, help much appreciated.
 
Old April 13th, 2006, 10:12 AM
Registered User
 
Join Date: Apr 2006
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
Default

Use this.Refresh() to repaint the screen

Sridhar Subramanian
The Following User Says Thank You to omegasri For This Useful Post:
Alan8 (January 10th, 2014)
 
Old May 26th, 2006, 06:10 AM
Registered User
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've used this.Refresh(), this.Invalidate() and this.Update().
I've also tried Application.DoEvents() and the form still won't refresh.

Any more ideas?

Simon
 
Old March 28th, 2007, 12:12 AM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Corayzon
Default

You need to call the process on another thread.

In the event Click for your button you can...

System.Threading.Thread thdWorker = new ... (MethodToCall);

Then simply call thdWorker.Start();

You'll find that you get cross thread operation errors when calling form object methods on this thread. You solve this by invoking each call to the main thread that created the form.

For help on invoking thread operations just search for information on the Invoke method on MSDN.

-Matt

 
Old June 16th, 2010, 10:52 AM
Registered User
 
Join Date: Jun 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Auto Refresh with timer in C# 2008

Greeting!

Hello everybody I'm Alex i have little problem, i can't solve may problem on how to make auto refresh in a minute the windows form Application in c# 2008 using timer..if possible.. help me.

thanks a lot.
 
Old June 16th, 2010, 01:34 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Your problem is on line 13...

Maybe you could be a little more specific on your problem???
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to refresh treeview in windows form watermoon C# 0 July 18th, 2007 09:49 AM
How to refresh owner form on closing of child form akumarp2p C# 2005 0 December 22nd, 2006 10:27 AM
windows forms datagrid - refresh ab_dev General .NET 0 March 1st, 2006 06:37 PM
Preventing Windows Form Automatic Refresh? Ron Howerton VB.NET 2002/2003 Basics 9 June 17th, 2004 08:48 AM
Refresh form while updating linked form mfletch Access 0 February 26th, 2004 10:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.