Click here to Skip to main content
Click here to Skip to main content
Alternative Tip/Trick

Tagged as

Pass value between forms using events

, 5 Aug 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
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)

Share

About the Author

César de Souza
Engineer Xerox Research Center Europe
Brazil Brazil
Computer and technology enthusiast, interested in artificial intelligence and image processing. Has a Master's degree on Computer Science specialized on Image and Signal Processing, with expertise on Machine Learning, Computer Vision, Pattern Recognition and Data Mining systems. Author of the Accord.NET Framework for developing scientific computing applications.
 
If you would like to hire good developers to build your dream application, please check out DaitanGroup, one of the top outsourcing companies in Brazil. This company, located in Brazil's Sillicon Valley but with US-based offices, has huge experience developing telecommunications software for large and small companies worldwide.
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

 
GeneralReason for my vote of 2 While it works in principle, it tigh... Pinmemberjim lahey1-Feb-12 23:35 
GeneralReason for my vote of 1 noob PinmemberBarbo1-Sep-10 23:08 
GeneralIt all depends. If all you have is a form which asks for use... PinmemberCésar de Souza7-Aug-10 5:03 
GeneralReason for my vote of 3 See my comments below. PinmentorDaveyM697-Aug-10 4:44 
General1. Public properties in the object that raises an event is a... PinmentorDaveyM697-Aug-10 4:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.141022.2 | Last Updated 5 Aug 2010
Article Copyright 2010 by César de Souza
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid