Click here to Skip to main content
16,005,038 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to change my line color while debugging. Pin
Abhijit Jana24-Jan-08 21:33
professionalAbhijit Jana24-Jan-08 21:33 
GeneralRe: How to change my line color while debugging. Pin
Sophia Rekhi24-Jan-08 23:42
Sophia Rekhi24-Jan-08 23:42 
Questionhow to hold the modifed data fro grid Pin
jaddu24-Jan-08 20:30
jaddu24-Jan-08 20:30 
AnswerRe: how to hold the modifed data fro grid Pin
Mircea Puiu24-Jan-08 20:56
Mircea Puiu24-Jan-08 20:56 
Questionhow to add .rpt and .cri extensions in IIS (windows 2000 with crystal reports 9 installed on the same) Pin
here2learn24-Jan-08 20:22
here2learn24-Jan-08 20:22 
QuestionEvent Handling in C# 2.0 Pin
A.Asif24-Jan-08 20:09
A.Asif24-Jan-08 20:09 
GeneralRe: Event Handling in C# 2.0 Pin
Mircea Puiu24-Jan-08 20:57
Mircea Puiu24-Jan-08 20:57 
GeneralRe: Event Handling in C# 2.0 Pin
CKnig24-Jan-08 21:35
CKnig24-Jan-08 21:35 
First you should change

A.Asif wrote:
public void SearchFiles(ArrayList list)
{
DataEvent(list); //raising event for testing
}


to

<br />
public void SearchFiles(ArrayList list)<br />
{<br />
   if (DataEvent != null)<br />
     DataEvent(list); //raising event for testing<br />
} <br />


just to handle the case when no handler is attached to the event.

Then if you've got an RaiseEventClass object (call it "myObj") and want to handle the event just use
myObj.DataEvent += new RaiseEventDelegate(myHandler )
where myHandler is a function like
<br />
void myHandler(ArrayList files)<br />
{<br />
 // TODO: whatever you want<br />
}<br />


By the way: afert typing "+= new" in the line where you attach the event you can hit <tab> twice and VS will write a handler-function for you (so you don't have to check the delegate to know exactly what kind of parameter / return you have to use)

One other comment:
you should include a "sender" parameter in every event you write (like object sender, or RaseEventClass sender - this helps you handle events from many sources in the same handler function and is always a good pattern.
Questioni create dll but can't get data back Pin
Naveed72724-Jan-08 20:04
Naveed72724-Jan-08 20:04 
GeneralRe: i create dll but can't get data back Pin
Giorgi Dalakishvili24-Jan-08 20:35
mentorGiorgi Dalakishvili24-Jan-08 20:35 
GeneralSetting the MySql Database password at runtime Pin
Imranlogi24-Jan-08 19:28
Imranlogi24-Jan-08 19:28 
GeneralRe: Setting the MySql Database password at runtime Pin
N a v a n e e t h24-Jan-08 19:39
N a v a n e e t h24-Jan-08 19:39 
GeneralRe: Setting the MySql Database password at runtime Pin
Imranlogi24-Jan-08 19:49
Imranlogi24-Jan-08 19:49 
GeneralRe: Setting the MySql Database password at runtime Pin
Gareth H24-Jan-08 23:58
Gareth H24-Jan-08 23:58 
Questionhow can i pass a vriable from one form to another usng C#.Net Pin
koolprasad200324-Jan-08 18:59
professionalkoolprasad200324-Jan-08 18:59 
AnswerRe: how can i pass a vriable from one form to another usng C#.Net Pin
N a v a n e e t h24-Jan-08 19:44
N a v a n e e t h24-Jan-08 19:44 
AnswerRe: how can i pass a vriable from one form to another usng C#.Net Pin
Giorgi Dalakishvili24-Jan-08 20:36
mentorGiorgi Dalakishvili24-Jan-08 20:36 
AnswerRe: how can i pass a vriable from one form to another usng C#.Net Pin
Pete O'Hanlon24-Jan-08 22:23
mvePete O'Hanlon24-Jan-08 22:23 
GeneralRe: how can i pass a vriable from one form to another usng C#.Net Pin
N a v a n e e t h24-Jan-08 22:37
N a v a n e e t h24-Jan-08 22:37 
GeneralRe: how can i pass a vriable from one form to another usng C#.Net Pin
Pete O'Hanlon24-Jan-08 22:40
mvePete O'Hanlon24-Jan-08 22:40 
GeneralRe: how can i pass a vriable from one form to another usng C#.Net Pin
N a v a n e e t h24-Jan-08 22:44
N a v a n e e t h24-Jan-08 22:44 
GeneralRe: how can i pass a vriable from one form to another usng C#.Net Pin
Pete O'Hanlon24-Jan-08 22:54
mvePete O'Hanlon24-Jan-08 22:54 
GeneralRe: how can i pass a vriable from one form to another usng C#.Net Pin
N a v a n e e t h24-Jan-08 23:02
N a v a n e e t h24-Jan-08 23:02 
GeneralPass IP address Pin
Prabhat00324-Jan-08 18:59
Prabhat00324-Jan-08 18:59 
GeneralRe: Pass IP address Pin
imsathy24-Jan-08 19:48
imsathy24-Jan-08 19:48 

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

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