473,395 Members | 1,454 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
Nov 21 '05 #1
3 947
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
Nov 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/>
Nov 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/>

Nov 21 '05 #4

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

Similar topics

2
by: jb | last post by:
Hello, I need to know which button was pressed in the submit , i tried reading the vaule of submit it the validateDate function but it returns 'undefined' value ; I do this in asp all the time, Not...
1
by: Lee David | last post by:
I have a page that has menu buttons on it. There are regular, over and down images that I swap. The problem is I can't seem to get the buttons to stick. So if I click the "News" image, that page...
1
by: Stan | last post by:
If a page has a button with event handler private void btnAdd_Click(object sender, System.EventArgs e) { ....... } this event handler fires every time I refresh the page in the browser with...
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...
1
by: JHawk24821 | last post by:
I am building a simple card matching game where the user picks two buttons on a form out of a group of buttons in an attempt to find a match. I have already taken care of the randomization needed...
5
by: sumeetmakkar | last post by:
Hi all, I am a begineer and working on a project. Facing trouble linking a submit buuton to a page of my choice.Script i am using is: <SCRIPT language=JavaScript><!-- function validate(form) {...
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: 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
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
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,...
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...

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.