Updating progress bar on Form1 FROM Form2

G

Guest

C# 2.0

How can i update my progress bar on Form1, from Form2? Form 2 contains a
button that is supposed to update the progressbar on Form1 by 5 in value.
I can't find out how to do this, please help me with some code samples :)

Thanks!
 
F

Frans Bouma [C# MVP]

Svein said:
C# 2.0

How can i update my progress bar on Form1, from Form2? Form 2
contains a button that is supposed to update the progressbar on Form1
by 5 in value. I can't find out how to do this, please help me with
some code samples :)

Thanks!

A winforms application is single threaded. So if you want to alter a
control on Form1 from Form2, you should call a method of Form1 from
Form2 (e.g. inside the eventhandler of the button) and that method of
Form1 then alters the progress bar.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 
R

Ryan Ramsey

So calling an event is easy... Put how would you do something like (from
form 1) form2.label.text = "data from form 1"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top