Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

Pass value between forms using events

3.11/5 (5 votes)
5 Aug 2010CPOL 12.6K  
Alternatively, you could just expose some public properties and raise a standard event. In the event handler you could read the properties as usual, without having to define a new EventArgs.Also if you really need to set properties on the owner, you again could just expose some public...
Alternatively, you could just expose some public properties and raise a standard event. In the event handler you could read the properties as usual, without having to define a new EventArgs.

Also if you really need to set properties on the owner, you again could just expose some public properties and then pass the owner as an argument when calling ShowDialog(), requiring no events at all.

Which is best depends on the situation, but usually I would avoid defining a new EventArgs just to pass text around.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)