Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

C# Refresh Underlying form data

Posted on 2008-11-18
7
Medium Priority
?
562 Views
Last Modified: 2012-06-27
I am working on a C# winforms application.

I have Form1 and Form2.

On Form1, I have Label1.  I open Form2 by clicking on a button on Form1 (Form1 remains open as well).

When I close Form2, or perform another method on Form2, I would like to refresh the text in Form1.Label1.

Can anyone help me with the code to do this.

Thanks.
0
Comment
Question by:jamesdean666
  • 3
  • 2
  • 2
7 Comments
 
LVL 26

Expert Comment

by:Anurag Thakur
ID: 22985789
you need to implement delegate and event in this case
in form2 closing event you will raise an event which will be handled by a hanlder for the event and delegate in form1
please go through the following link as its implemeting something similar to your requirements
http://www.experts-exchange.com/Programming/Languages/.NET/Q_23671134.html
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_CSharp/Q_23736959.html
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_CSharp/Q_23795439.html

all the links have my reference in them :)
Cheers - Ragi
0
 
LVL 1

Expert Comment

by:klace06
ID: 22985798
hi suggestion why dont u use events when u close form 2 fire an event which is handled in form1
when the event is fired , the event handler will have code to change the label1's text
0
 
LVL 1

Expert Comment

by:klace06
ID: 22985805
you dont need delegates only if u are passing event values can be done without delegates
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:jamesdean666
ID: 22986370
I am still struggling with this.. Can you please provide some code?
0
 
LVL 26

Accepted Solution

by:
Anurag Thakur earned 2000 total points
ID: 22986498
the code pieces are provided in all the 3 links i have pasted
and i know that they are working
0
 
LVL 1

Expert Comment

by:klace06
ID: 22986705
can you post the code snippet that you have and i can modify it to work
0
 

Author Closing Comment

by:jamesdean666
ID: 31517889
Thnx.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses
Course of the Month13 days, 1 hour left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question