|
-
Aug 1st, 2005, 07:20 AM
#1
Thread Starter
Addicted Member
How To : User Control
Hi all
I've created a user control that contains 3 buttons Add / Modify / Delete. The click events of the controls are calling abstract methods. I'm placing the control on a form, form1.cs file, i would like to call a specific method for the click of the add button of the control. Can anybody help me on accomplishing this?
-
Aug 1st, 2005, 07:27 AM
#2
Re: How To : User Control
You should raise the click events for each button in your control so that you can handle them in your form. Take a look at this event bubbling sample on MSDN:
http://msdn.microsoft.com/library/de...trolsample.asp
-
Aug 5th, 2005, 01:08 AM
#3
Thread Starter
Addicted Member
Re: How To : User Control
Thanks Mendhak.
But the link you provided did not help me much. So can you pls. give me an example or a link for an example so that I can get more r clear soln. My actual problem is i have a user control which is having command button add I placed user control in my class from1.cs when I click on the user control add button, Adding() method should be call in the form1.cs. how to do this task.
 Originally Posted by mendhak
-
Aug 5th, 2005, 02:27 AM
#4
Hyperactive Member
Re: How To : User Control
You could just do this
Code:
UserControl.Parent.Adding()
But actually I dont think this is good application design! Have alook at mendhaks solution, let your userForm raise an event when Button add is clicked. Have your form subscribe to that event and handle what to do there!
HTH,
Stephan
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|