473,465 Members | 2,103 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How To Raise Click Event to Usercontrol Button in Form

73 New Member
Hi Experts,
am working with c#.net 3.5 windows application.

in my project i have a usercontrol with only a single button.

in my windows form based on some condition am displaying number of buttons here.
for eample i want to display n number of buttons dynamically, here am displaying that usercontrol n times.

but how can i raise clickevent to all those Usercontrol buttons in my windows form?


Please share some code or ideas regarding this (Itz urgent)

Thanks in Advance
--Naren
Mar 25 '09 #1
4 9479
tlhintoq
3,525 Recognized Expert Specialist
Of course its urgent.
Start typing the following in Visual Studio.

button bob = new button();
bob.Click += new .....

At this point VIsual Studio will fill in a new handler call for you, just follow the prompts to hit [TAB] to fill in the delegate and [TAB] again to have Visual Studio make a method for you.
Mar 25 '09 #2
Vajrala Narendra
73 New Member
Thanks for replying
but my requirement is not to create inside that form
i want to create clickevent of a usercontrol inside windowsform.
i may have more than one button, to all those buttons also i have to create events.
Mar 26 '09 #3
tlhintoq
3,525 Recognized Expert Specialist
Right...

On your click event of the usercontrol make the new buttons. In my example I named them bob but you can call them whatever you like.
Wen you make the new button, assign its click event to the handler of your choice.
Mar 26 '09 #4
sammartin
4 New Member
How about Button.PerformClick()

Raises a click event on a button object

HTH
Sam
Mar 27 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: asr | last post by:
I've a form with a button on it. How to raise (I mean to run the code within the click event of the button) without clicking the button? Is it possible to raise the events programatically.
3
by: Cary Linkfield | last post by:
I have a standard form I use. It inherits from Windows.Forms.Form. I usually add a Cancel button the form in the designer. I want to raise the Cancel button's Click event when the user presses...
3
by: Todd Schinell | last post by:
Back in July, Jeffery Tan posted this: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=OWOTdf0VDHA.2296%40cpmsftngxa06.phx.gbl In response as to how to get click events from a...
0
by: Pingo | last post by:
Hi! How do I handle a Page event in my UserControl. My .aspx page contain 5 different buttons and one of them is the SAVE button. All buttons do PostBack to the page but only one should Save...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
2
by: Simon Verona | last post by:
I have a usercontrol with code in the "leave" event which updates the final data back into a database. This works fine except if I have a default "accept" button on a form and invoke it by...
0
by: davidr | last post by:
Hi, I've read about bubble events and setting up the event args and several other methods to have an event that occurs in a usercontrol flow up to the parent. The problem is each one entails a...
2
by: William | last post by:
Hi I've created a page with only 'n blank table control on it. When clicking a button, the table populates with various textboxes and dropdown lists to make up a complete form. In the last row...
2
by: \(O\)enone | last post by:
I'm trying to create a usercontrol that is transparent, both visibly and to mouse clicks. I can make the usercontrol visibly transparent by setting the SupportsTransparentBackColor style and...
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
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
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...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.