Click here to Skip to main content
15,883,458 members
Home / Discussions / C#
   

C#

 
GeneralRe: About Thread Priority Pin
Robert Rohde18-Apr-06 6:07
Robert Rohde18-Apr-06 6:07 
GeneralRe: About Thread Priority Pin
Bob_Sun18-Apr-06 6:43
Bob_Sun18-Apr-06 6:43 
GeneralRe: About Thread Priority Pin
LongRange.Shooter18-Apr-06 10:43
LongRange.Shooter18-Apr-06 10:43 
GeneralRe: About Thread Priority Pin
Bob_Sun18-Apr-06 14:07
Bob_Sun18-Apr-06 14:07 
GeneralRe: About Thread Priority Pin
LongRange.Shooter18-Apr-06 17:35
LongRange.Shooter18-Apr-06 17:35 
QuestionHow to print directly to parallel port Pin
vatzcar17-Apr-06 23:12
vatzcar17-Apr-06 23:12 
QuestionSubscribing on events… a must? Pin
anderslundsgard17-Apr-06 22:20
anderslundsgard17-Apr-06 22:20 
AnswerRe: Subscribing on events… a must? Pin
J4amieC17-Apr-06 22:47
J4amieC17-Apr-06 22:47 
You must first check if there are any subscribers to the event bvefore raising it...this is usually done with a particular pattern of event/protected method.

public class MyClassWithEvent
{
  public event EventHandler MyEvent


  protected virtual void OnMyEvent(EventArgs e)
  {
    if(MyEvent != null)
    {
       MyEvent(this,e);
    }
  }
}


The reason its done like this is 2-fold.

1) It enables methods in your class to easily raise the event without worrying if there are any subscribers... so you could have a method in there like:

public void DoSomethingAndRaiseMyEvent()
{
   // do something here
  this.OnMyEvent(EventArgs.Empty);
}


2) It enables derived classes to change the behaviour slightly by overriding OnMyEvent.
GeneralRe: Subscribing on events… a must? Pin
anderslundsgard17-Apr-06 23:26
anderslundsgard17-Apr-06 23:26 
Questioncreating dynamic checkboxes Pin
umaheshchandra17-Apr-06 21:17
umaheshchandra17-Apr-06 21:17 
AnswerRe: creating dynamic checkboxes Pin
alexey N17-Apr-06 21:24
alexey N17-Apr-06 21:24 
AnswerRe: creating dynamic checkboxes Pin
J4amieC17-Apr-06 22:00
J4amieC17-Apr-06 22:00 
QuestionWindows Form icon Pin
TheEagle17-Apr-06 21:15
TheEagle17-Apr-06 21:15 
AnswerRe: Windows Form icon Pin
vatzcar17-Apr-06 21:48
vatzcar17-Apr-06 21:48 
GeneralRe: Windows Form icon Pin
TheEagle19-Apr-06 7:02
TheEagle19-Apr-06 7:02 
QuestionFilling datatable with recordset data using OleDBDataAdapter's fill method Pin
Maau2117-Apr-06 20:55
Maau2117-Apr-06 20:55 
QuestionHow I get Microsoft excel range object which contain merged cells with c# Pin
Old Gun17-Apr-06 20:51
Old Gun17-Apr-06 20:51 
Questionhow can i create document for my dll Pin
iman_kh17-Apr-06 20:34
iman_kh17-Apr-06 20:34 
AnswerRe: how can i create document for my dll Pin
alexey N17-Apr-06 20:41
alexey N17-Apr-06 20:41 
Questionwithevents in c# Pin
abhinish17-Apr-06 20:22
abhinish17-Apr-06 20:22 
AnswerRe: withevents in c# Pin
Christian Graus17-Apr-06 20:40
protectorChristian Graus17-Apr-06 20:40 
AnswerRe: withevents in c# Pin
HimaBindu Vejella17-Apr-06 23:32
HimaBindu Vejella17-Apr-06 23:32 
Questionimporting excel data to sql server Pin
genx_code17-Apr-06 20:20
genx_code17-Apr-06 20:20 
AnswerRe: importing excel data to sql server Pin
Monin D.17-Apr-06 21:13
Monin D.17-Apr-06 21:13 
GeneralRe: importing excel data to sql server Pin
genx_code18-Apr-06 16:34
genx_code18-Apr-06 16:34 

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.