Interview questions

.Net - how to implement event handlers

Next question>>           Learn .NET
.Net - Describe how to implement event handlers and associate them with events. - June 03, 2009 at 11:00 AM by Shuchi Gauri

Describe how to implement event handlers and associate them with events.

public class MyClass
{

     public static event MyCustomHandler MyEvent;
     public static void Main()
     {
         MyCustomListener mcll = new MyCustomListener();
         MyEvent += new MyCustomHandler(mcl1.Show);
         GetAge();
     }
     public static void OnMyEvent(MyEventArgse)
     {
         if(MyEvent!=null)
             MyEvent(new object(),e);
     }
      public static void GetAge()
      {
          MyEventArgse1 = new MyEventArgs(25);
          OnMyEvent(e1);
       }
}

Next question>>

Also read

ASP.NET Handling the DataList control events

The Repeater, DataList, and DataGrid controls support event bubbling. What is event bubbling? Event Bubbling refers to the ability of a control to capture the events in a child control and bubble up the event to the container whenever an event occurs...........

What are the events in GLOBAL.ASAX file?

Global.asax file contains the following events: Application_Init, Application_Disposed, Application_Error, Application_Start, Application_End............

ASP.NET server control events

ASP.NET web form supports many server controls like Button, TextBox etc. Each control has associated events. There are three types of server control events..............

ASP.NET server controls vs. HTML controls

Server events, State management, Browser detection, Properties.............

ASP.NET exception handling technique

Define Exception handling in ASP.NET.
What are the ways of handling exceptions in ASP.NET?
Explain Try/catch block method of exception handling.
Define Error Events.
Define Custom Error Pages.
Why is exception handling important to an application?
When can you use tracing with exception handling?................  

ASP.NET application life cycle and events processing

A web application starts when a browser requests a page of the application first time. The request is received by the IIS which then starts ASP.NET worker process (aspnet_wp.exe). The worker process then allocates a process space to the assembly and loads it............. 



Write your comment - Share Knowledge and Experience


 

 
Latest placement tests
Latest links
 
Latest MCQs
» General awareness - Banking » ASP.NET » PL/SQL » Mechanical Engineering
» IAS Prelims GS » Java » Programming Language » Electrical Engineering
» English » C++ » Software Engineering » Electronic Engineering
» Quantitative Aptitude » Oracle » English » Finance
Home | About us | Sitemap | Contact us | We are hiring