473,387 Members | 1,569 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,387 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 1108
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.