Click here to Skip to main content
12,243,522 members (47,897 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

4.5K views
Posted

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.

You may also be interested in...

Comments and Discussions

 
GeneralReason for my vote of 2 While it works in principle, it tigh... Pin
jim lahey2-Feb-12 0:35
memberjim lahey2-Feb-12 0:35 
GeneralReason for my vote of 1 noob Pin
Barbo2-Sep-10 0:08
memberBarbo2-Sep-10 0:08 
GeneralIt all depends. If all you have is a form which asks for use... Pin
César de Souza7-Aug-10 6:03
memberCésar de Souza7-Aug-10 6:03 
GeneralReason for my vote of 3 See my comments below. Pin
DaveyM697-Aug-10 5:44
mentorDaveyM697-Aug-10 5:44 
General1. Public properties in the object that raises an event is a... Pin
DaveyM697-Aug-10 5:43
mentorDaveyM697-Aug-10 5:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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 | Terms of Use | Mobile
Web02 | 2.8.160426.1 | Last Updated 5 Aug 2010
Article Copyright 2010 by César de Souza
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid