473,657 Members | 2,763 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Updating progress bar on Form1 FROM Form2

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!
Aug 19 '06 #1
2 2838
Svein Erik wrote:
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#)
------------------------------------------------------------------------
Aug 21 '06 #2
So calling an event is easy... Put how would you do something like (from
form 1) form2.label.tex t = "data from form 1"
"Frans Bouma [C# MVP]" <pe************ ******@xs4all.n lwrote in message
news:xn******** *******@news.mi crosoft.com...
Svein Erik wrote:
>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#)
------------------------------------------------------------------------

Aug 25 '06 #3

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

Similar topics

1
3763
by: nic | last post by:
Hi I have two forms form1 and form2. I am trying to get all the data entered in form1 to be updated to the table on an event. ie. when I click the button to load form2, I need the data from form1 to exist in the table for relationship reasons. form2 works fine if the records displayed in form1 already exist in the table, ie form1 was closed then re-opened or moving between records will also write the data to the table. But if I have...
9
13608
by: Popoxinhxan | last post by:
Dear experts, i want to develop an client application that consume the google search web service. In my MainForm i have a method to retrieve all the search result e.g. GetGoogleResults(). Now i want to have a nice progress bar in another form e.g ProgressForm to perform the search action. i tried to do it but the progress bar won't work and the GUI freezed. I knew how to do with the single threading but i don't know how to do it in...
0
1391
by: Art Guerra | last post by:
Any tips or information would be most appreciated! Here is my scenario simplified: I have a main application form (Form1) and on that form is a listView control. On a separate form (Form2), the user is able to select a folder using a folderBrowser control. I want the paths to all files to be added to the listView control on Form1. My question lies around what thread should perform the item additions. Currently, on Form2, I referenced...
5
3788
by: nadir b | last post by:
hi I don't know how to change for exemple a form1 caption text from form2 don't forget that form2 has created from form1 I want sample code with c# *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
3
1699
by: Geoff Jones | last post by:
Hi I posted a question yesterday but didn't get any replies - probably because I didn't give enough information to what I'm trying to do, so here we go again but this time with a bit more detail: In my main application form, I am performing some lengthy calculations. During these calculations I want to display another form with a progress control in it to give the user an idea of how far the calculations have gone. For the sake of...
5
1849
by: PAPutzback | last post by:
Form2 has one purpose to open and list some names and ids. I want to handle the list box click event on form2 so I can get the selected value onto a field in form1. I changed this Dim MyForm2 As New PHfx.Form2 to With Events MyForm2 As New PHfx.Form2 and tried adding an event handler but intellisense will not show form2s objects, just the methods.
3
2470
by: R. Harris | last post by:
Hi. I have 2 forms: form1 form2 On Form2 I have a listbox and a button. When I click the button it calls a function from form1 and within that function it updates the listbox on form2. My problem is I don't see the items added to the listbox unless I use
3
3079
by: Luvin lunch | last post by:
Hi All, I have a grid (i.e. continuous form) on Form1, that opens a second form (not a subform) Form2 when the user double clicks on it. On form2 the user can save information. When the user selects Save, I want to reload Form1 because the changes in Form2 will change the order that records should appear on Form1. I have implemented this functionality as follows: Private Sub cmdSave_Click()
1
1476
by: explode | last post by:
My table has 5 columns: Broj iksice, Prezime, Ime, Broj indeksa, Broj pohadjanja. This is the code in the dataset designer VB made it by it self: Private Sub InitClass() Me.columnBroj_iksice = New System.Data.DataColumn("Broj iksice", GetType(Double), Nothing, System.Data.MappingType.Element) Me.columnBroj_iksice.ExtendedProperties.Add("Generator_ColumnPropNameInRow", "Broj_iksice")...
0
8306
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
Oralloy
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...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
tracyyun
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...
0
7327
agi2029
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...
0
4152
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...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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
2
1615
bsmnconsultancy
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...

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.