Click here to Skip to main content
15,900,816 members
Home / Discussions / C#
   

C#

 
AnswerRe: Encryption and descryption using 3DES Pin
OriginalGriff16-Feb-11 22:48
mveOriginalGriff16-Feb-11 22:48 
AnswerRe: Encryption and descryption using 3DES Pin
Bernhard Hiller16-Feb-11 22:56
Bernhard Hiller16-Feb-11 22:56 
AnswerRe: Encryption and descryption using 3DES Pin
RaviRanjanKr21-Feb-11 18:05
professionalRaviRanjanKr21-Feb-11 18:05 
QuestionHow to prevent usage of class libraries shipped with application? Pin
Chesnokov Yuriy16-Feb-11 21:37
professionalChesnokov Yuriy16-Feb-11 21:37 
AnswerRe: How to prevent usage of class libraries shipped with application? Pin
Groulien16-Feb-11 22:58
Groulien16-Feb-11 22:58 
AnswerRe: How to prevent usage of class libraries shipped with application? Pin
Bernhard Hiller16-Feb-11 23:07
Bernhard Hiller16-Feb-11 23:07 
AnswerRe: How to prevent usage of class libraries shipped with application? Pin
jschell17-Feb-11 8:27
jschell17-Feb-11 8:27 
QuestionRaise COM Event within C# Pin
califax2k16-Feb-11 21:03
califax2k16-Feb-11 21:03 
Hi all,

I am currently trying to send a COM Event from a .NET Assembly to another application. Therefore I am applying the approach that's found multiple times across the internet. Here it's outlined for short.

[ComVisible(false)]
public delegate void OnNotifyDelegate();

[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface Events
{
    void OnNotify();
}

[Guid(EventSource.ClsID)]
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(Events))]
public class EventSource : ServicedComponent, EventInterface
{
    private const string ClsID = "4A235195-E8B3-473b-8F14-F7F0ADFC40E0";

    public event OnNotifyDelegate OnNotify;

    public EventSource() { }

    public void CauseOnNotify()
    {
        OnNotify();
    }
}


Now, to raise the OnNotify Event I created a small WPF Application with a button, whose Click handler invokes the method CauseOnNotify above. I don't show it here, because that would be verbose.

What I get is a NullPointerException because OnNotify is at the time it's invoked null.

My question is: None of the examples mentions a instanciation of the delegate (which is why its null, but under which circumstances does this exception not happen? Where is the instance coming from?

thanks in advance

Lars
#pragma error( disable : * )

AnswerRe: Raise COM Event within C# Pin
Bernhard Hiller16-Feb-11 23:14
Bernhard Hiller16-Feb-11 23:14 
QuestionDLL and config file problem Pin
david bagaturia16-Feb-11 20:56
david bagaturia16-Feb-11 20:56 
AnswerRe: DLL and config file problem Pin
Bernhard Hiller17-Feb-11 3:09
Bernhard Hiller17-Feb-11 3:09 
QuestionAlt+Numkeys in textbox control Pin
NarVish16-Feb-11 20:18
NarVish16-Feb-11 20:18 
AnswerRe: Alt+Numkeys in textbox control Pin
Richard MacCutchan16-Feb-11 21:50
mveRichard MacCutchan16-Feb-11 21:50 
GeneralRe: Alt+Numkeys in textbox control Pin
NarVish16-Feb-11 22:27
NarVish16-Feb-11 22:27 
GeneralRe: Alt+Numkeys in textbox control Pin
OriginalGriff16-Feb-11 22:40
mveOriginalGriff16-Feb-11 22:40 
AnswerRe: Alt+Numkeys in textbox control Pin
Luc Pattyn17-Feb-11 1:04
sitebuilderLuc Pattyn17-Feb-11 1:04 
AnswerRe: Alt+Numkeys in textbox control Pin
Manish Choudhary .NET expert18-Feb-11 2:01
Manish Choudhary .NET expert18-Feb-11 2:01 
Questionlooking for how to make my own MessageBox sample code Pin
goldsoft16-Feb-11 19:58
goldsoft16-Feb-11 19:58 
AnswerRe: looking for how to make my own MessageBox sample code Pin
JF201516-Feb-11 20:17
JF201516-Feb-11 20:17 
AnswerRe: looking for how to make my own MessageBox sample code Pin
SilimSayo18-Feb-11 7:34
SilimSayo18-Feb-11 7:34 
AnswerRe: looking for how to make my own MessageBox sample code Pin
RaviRanjanKr21-Feb-11 18:13
professionalRaviRanjanKr21-Feb-11 18:13 
QuestionOleDbDataReader getChars sequentia access Pin
joaoviegas16-Feb-11 14:20
joaoviegas16-Feb-11 14:20 
AnswerRe: OleDbDataReader getChars sequentia access Pin
PIEBALDconsult16-Feb-11 15:43
mvePIEBALDconsult16-Feb-11 15:43 
QuestionHow to tell what object is associate with context menu Pin
Member 225653316-Feb-11 9:53
Member 225653316-Feb-11 9:53 
AnswerRe: How to tell what object is associate with context menu Pin
Luc Pattyn16-Feb-11 10:02
sitebuilderLuc Pattyn16-Feb-11 10:02 

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.