Click here to Skip to main content
15,922,533 members
Home / Discussions / C#
   

C#

 
GeneralRe: I want to show Time Field of a MS Access table into a datagridview Pin
Sourie25-Sep-08 20:08
Sourie25-Sep-08 20:08 
Questionhow to read font files Pin
GSSPriya24-Sep-08 20:08
GSSPriya24-Sep-08 20:08 
QuestionCommunication break in sending data through mscomm Pin
tauras8124-Sep-08 19:28
tauras8124-Sep-08 19:28 
QuestionFill Slope like Shape. Pin
RameshMRameshM24-Sep-08 19:25
RameshMRameshM24-Sep-08 19:25 
QuestionHow to hide OS and run only SINGLE application Pin
Sifar - 024-Sep-08 19:19
Sifar - 024-Sep-08 19:19 
AnswerRe: How to hide OS and run only SINGLE application Pin
vimal_yet24-Sep-08 20:01
vimal_yet24-Sep-08 20:01 
GeneralRe: How to hide OS and run only SINGLE application Pin
blackjack215024-Sep-08 21:59
blackjack215024-Sep-08 21:59 
AnswerRe: How to hide OS and run only SINGLE application Pin
Mark Churchill24-Sep-08 20:31
Mark Churchill24-Sep-08 20:31 
AnswerRe: How to hide OS and run only SINGLE application Pin
Vimalsoft(Pty) Ltd24-Sep-08 21:21
professionalVimalsoft(Pty) Ltd24-Sep-08 21:21 
GeneralRe: How to hide OS and run only SINGLE application Pin
Sifar - 024-Sep-08 23:16
Sifar - 024-Sep-08 23:16 
GeneralRe: How to hide OS and run only SINGLE application Pin
Vimalsoft(Pty) Ltd25-Sep-08 1:43
professionalVimalsoft(Pty) Ltd25-Sep-08 1:43 
AnswerRe: How to hide OS and run only SINGLE application Pin
#realJSOP24-Sep-08 23:28
professional#realJSOP24-Sep-08 23:28 
AnswerRe: How to hide OS and run only SINGLE application Pin
Sifar - 028-Sep-08 22:51
Sifar - 028-Sep-08 22:51 
QuestionProcessing a German Cultured Excel file using C# Pin
Prasanna Kumar Pete24-Sep-08 19:10
Prasanna Kumar Pete24-Sep-08 19:10 
GeneralRe: Processing a German Cultured Excel file using C# Pin
HemJoshi24-Sep-08 22:24
HemJoshi24-Sep-08 22:24 
GeneralRe: Processing a German Cultured Excel file using C# Pin
Prasanna Kumar Pete24-Sep-08 22:30
Prasanna Kumar Pete24-Sep-08 22:30 
AnswerRe: Processing a German Cultured Excel file using C# Pin
HemJoshi25-Sep-08 22:11
HemJoshi25-Sep-08 22:11 
GeneralRe: Processing a German Cultured Excel file using C# Pin
Prasanna Kumar Pete25-Sep-08 22:14
Prasanna Kumar Pete25-Sep-08 22:14 
QuestionRe: Processing a German Cultured Excel file using C# Pin
HemJoshi25-Sep-08 22:47
HemJoshi25-Sep-08 22:47 
AnswerRe: Processing a German Cultured Excel file using C# Pin
HemJoshi25-Sep-08 22:48
HemJoshi25-Sep-08 22:48 
QuestionExport PDF file in C# Pin
r aa j24-Sep-08 18:33
r aa j24-Sep-08 18:33 
AnswerRe: Export PDF file in C# Pin
blackjack215024-Sep-08 22:29
blackjack215024-Sep-08 22:29 
Questionwierd wierd wierd exception Pin
nelsonpaixao24-Sep-08 13:51
nelsonpaixao24-Sep-08 13:51 
AnswerRe: wierd wierd wierd exception Pin
PIEBALDconsult24-Sep-08 17:15
mvePIEBALDconsult24-Sep-08 17:15 
AnswerRe: wierd wierd wierd exception Pin
DaveyM6924-Sep-08 23:26
professionalDaveyM6924-Sep-08 23:26 
As PiebaldConsult said - check that there are subscribers to the events before raising them.

The standard way is something like:
public delegate void Delegate_DriverPageInfo(string msg);
public event Delegate_DriverPageInfo Event_DriverPageInfo;
// Method or Property Setter etc...
public void YourMethod()
{
    // stuff
    // event needs raising
    OnEvent_DriverPageInfo("Message");
}
protected virtual void OnEvent_DriverPageInfo(string message)
{
    if (Event_DriverPageInfo != null)
        Event_DriverPageInfo(message);
}

It's actually more normal to have your own class that derives from event args and pass the message that way - but it's not neccesary, just the norm.
public class DriverPageInfoEventArgs : EventArgs
{
    public DriverPageInfoEventArgs(string message)
    {
        m_Message = message;
    }
    private string m_Message;
    public string Message
    {
        get{ return m_Message; }
    }
}
...
public delegate void Delegate_DriverPageInfo(object sender, DriverPageInfoEventArgs e);
public event Delegate_DriverPageInfo Event_DriverPageInfo;
public void YourMethod()
{
    // stuff
    // event needs raising
    DriverPageInfoEventArgs e = new DriverPageInfoEventArgs("Message");
    OnEvent_DriverPageInfo(e);
}
protected virtual void OnEvent_DriverPageInfo(DriverPageInfoEventArgs e)
{
    if (Event_DriverPageInfo != null)
        Event_DriverPageInfo(this, e);
}

Whichever way, the important thing is the null check in the OnEvent... method.

Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Expect everything to be hard and then enjoy the things that come easy. (code-frog)

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.