Welcome to MSDN Blogs Sign in | Join | Help

How do I inform one form that data in another form got changed?

Abstract
This short sample demonstrates how to let one form in a Windows Forms application know when data in another form got changed. To implement this behavior I’ll show you how to create an event on Form2 and how to subscribe to this event on Form1 using the Handles keyword. The C# source code uses delegates to implement the aforementioned behavior.
NotifyAnotherForm.png

How Do I Video
The corresponding How-Do-I video can be found here.

Source Code
Visual Basic | C#

Additional Resources
Handling and Raising Events
Events in Visual Basic

Prerequisites
The examples were created using Visual Basic 2008 Express but do also apply to older versions of Visual Studio. Even though this concept is demonstrated in Windows Forms the same pattern can be used in WPF.

Enjoy!

   Daniel

Published Wednesday, September 16, 2009 9:08 AM by Walzenbach

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker