Click here to Skip to main content
Licence 
First Posted 25 Feb 2004
Views 31,158
Bookmarked 15 times

Event Control

By | 25 Feb 2004 | Article
How to declare and use the C# events in your application as Event Control.

Introduction

This article will explain how to declare and use the C# events in your application as Event Control. You can design your event control in couple of mints, making your event as control will be easy for GUI developers to implement events in client side.

Here are the steps:

  1. Create one Windows Application Project
  2. Add “Component Class” using "Add New Item". This is going to be your Event Control.
  3. Declare your delegate in your Event Control under your namespace.
    public delegate void SampleDelegate(string Str);
  4. Now declare your event inside your Event Control class.
    public event SampleDelegate Sample;
  5. Also add the FireTheEvent method to fire the event.
  6. Build the project.
  7. Go to Form, then ToolBox, add the Event Control using “Add/Remove Items” menu by right clicking on the tool box.
  8. Drag and drop the new control. Using the property window of the control you can easily implement the Event method in your application.
  9. Call The FireTheEvent method in your button click after adding new button to your form.
  10. Run the application and click on your button, you should see your Event firing.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

swami800



United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Generalpoes PinmemberTrance Junkie2:18 20 Dec '05  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 26 Feb 2004
Article Copyright 2004 by swami800
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid