473,395 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

What Button Was Clicked ??

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
Jul 21 '05 #1
3 1110
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
Jul 21 '05 #2
* "Charles A. Lackman" <Ch*****@CreateItSoftware.net> scripsit:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Jul 21 '05 #3
I Agree. Do a web search for "Observer Pattern"

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2o************@uni-berlin.de...
* "Charles A. Lackman" <Ch*****@CreateItSoftware.net> scripsit:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Robson Carvalho Machado | last post by:
Dear Friends, I have the following code that creates dynamic controls at my form. My dificult is how to correct this code to put distinct AddHandler to each button and how to choose what label...
2
by: Krista Lemieux | last post by:
Hello, In my form I have a button, and the button_Click function (which gets called when the button is clicked). However the functionality that I have in the button_Click function, needs to be...
7
by: Jimmy Jazz | last post by:
Hi, I have created a control with some buttons an alphabet. When one of these buttons are pressed it posts back and in the postback event for the button pressed a list of tems is created with a...
11
by: antonyliu2002 | last post by:
I know that this has been asked and answered thousands of times. As a matter of fact, I know that I need to say If Not Page.IsPostBack Then 'Do something End If for things that needs to be...
2
by: damonjulian | last post by:
hi ,i created 3 buttons such that if button1 is clicked it will disable button2 ,and clicking button3 will restore state of button2 to normal, to my dismay i find that button2 still responds to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.