Passing a value

vis781

Well-known member
Joined
Aug 30, 2005
Messages
2,016
Location
Cambridge, UK
Programming Experience
5-10
Sorry, i'm tired and for some reason i just cannot figure out how to do this though i know i should be able to.
What i have is an open form (call it form1), then i open another form(call it form2) (this is not an MDI application) i need to pass a datatable back to form1 when form2 closes. Help!!!
 
If you are showing Form2 with ShowDialog: just add a (ReadOnly will do) property to the interface of Form2, assign it the proper value before closing. You can then just query the property (closing a form shown with ShowDialog does not really 'close' the form: close then really just hides the form).
If you are using Show: define and set the property, add an eventhandler to the Closing event of Form2 (before showing the form) and query the property in the event handler.
 
Back
Top