Share via


How do I exchange data between two forms of a Windows Forms application?

I regularly check the forums to get an understanding what’s going on in the community and what’s troubling our customers. Based on my findings I created some videos including the corresponding source code which I’m releasing over the next couple of days and subsequently when things come up (and there is a lot out there :-))

Abstract
This short video shows how to exchange data between two forms of a Windows Forms application. You'll see how to use
1.) a public method and
2.) a public property to exchange data.

How do I exchange data between two forms of a Windows Forms application?

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

Source Code
Visual Basic | C#

Additional Resources
Access Modifiers in Visual Basic
Access Modifiers in C#
Property Usage Guidelines

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

Enjoy!

   Daniel