Application wide event?

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

Hey guys

Is it possible to create an event that is global to an application?

Thanks
 
Daniel,

Yes, there is no reason why you can not create an event that is a static
event, which would then be accessible to the whole app.

Hope this helps.
 
Cool, well sicne everything in c# is in a class, where would i delcare the
static event?

Make a static class and put it in there?


Nicholas Paldino said:
Daniel,

Yes, there is no reason why you can not create an event that is a
static event, which would then be accessible to the whole app.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Daniel said:
Hey guys

Is it possible to create an event that is global to an application?

Thanks
 
Daniel,

Just do this:

public class MyClass
{
public static event EventHandler MyEvent;
}

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Daniel said:
Cool, well sicne everything in c# is in a class, where would i delcare the
static event?

Make a static class and put it in there?


Nicholas Paldino said:
Daniel,

Yes, there is no reason why you can not create an event that is a
static event, which would then be accessible to the whole app.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Daniel said:
Hey guys

Is it possible to create an event that is global to an application?

Thanks
 
Ah so as i thought....ok thanks

Nicholas Paldino said:
Daniel,

Just do this:

public class MyClass
{
public static event EventHandler MyEvent;
}

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Daniel said:
Cool, well sicne everything in c# is in a class, where would i delcare
the static event?

Make a static class and put it in there?


Nicholas Paldino said:
Daniel,

Yes, there is no reason why you can not create an event that is a
static event, which would then be accessible to the whole app.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hey guys

Is it possible to create an event that is global to an application?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top