What Button Was Clicked ??

  • Thread starter Thread starter Charles A. Lackman
  • Start date Start date
C

Charles A. Lackman

Hello,

I have a project with multiple child forms (created from DLLs). When a
button in the child form is clicked the Parent form needs to know what
button was clicked. Any Suggestions will be greatly appreciated.

Thanks,

Chuck
 
Charles,

Never did this, however I think I would create a property in every mdi child
form form that I would fill when there was a button clicked in the events
something as this. Roughly typed, not tested just a gues.
\\\
Private lButton As Button
Public ReadOnly Property Lastbutton() As Button
Get
Return lButton
End Get
End Property
Button Click event
lButton = sender
end sub
///
That can be seen in the parent with mymdiform.Lastbutton.name

I hope this helps?

Cor
 
* "Charles A. Lackman said:
I have a project with multiple child forms (created from DLLs). When a
button in the child form is clicked the Parent form needs to know what
button was clicked. Any Suggestions will be greatly appreciated.

Define an event in your child form and add a handler to this event in
the main form. Then you can pass the reference to the control that
raises the event in the 'sender' parameter of your event.
 
I Agree. Do a web search for "Observer Pattern"

Herfried K. Wagner said:
Define an event in your child form and add a handler to this event in
the main form. Then you can pass the reference to the control that
raises the event in the 'sender' parameter of your event.
 
Back
Top