CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Calling C# DLL

  1. #1
    Join Date
    Nov 2004
    Posts
    239

    Unhappy Calling C# DLL

    I'm trying to setup a SelectionChangeHandler for a call to a DLL written in C#. In the C# DLL, the public declaration is as follows:

    public event SelectionChangedHandler SelectionChanged;


    To call this from C# I do the following:

    ofdPicture.SelectionChanged += new ExtensibleDialogs.OpenFileDialog.SelectionChangedHandler(ofdPicture_SelectionChanged);

    where ofdPicture_SelectionChanged is the name of my function in the C# calling program.


    If I try to use the same line in VB.NET I get the following error:

    Event SelectionChanged(path As String)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.

    Any idea on how to set this up correctly?

  2. #2
    Join Date
    Nov 2004
    Posts
    239

    Smile Resolved: Calling C# DLL

    I did the following and it worked great!

    AddHandler ofdPicture.SelectionChanged, AddressOf ofdPicture_SelectionChanged

    and when I was done with it:

    RemoveHandler ofdPicture.SelectionChanged, AddressOf ofdPicture_SelectionChanged

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured