473,388 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

events in interfaces

If I have the interface like this

Interface IPluginAddin
Event Loaded()
Event UnLoaded()
End Interface

I have one class implementing the interface, which also will raise the
events... how in the world do i write an event handler in another class or
form for that event which is in the interface? thanks

Nov 21 '05 #1
2 1369
something like this:

class MyClass
Implements IPluginAddin

Event MyEvent() Implements IPluginAddin.Loaded()
end class

As long as the signatures match, you should be good to go. Since you only
need to match the event signature, a single event can implement multiple
matching interface events which in your case would be something like:

class MyClass
Implements IPluginAddin

Event MyEvent() Implements IPluginAddin.Loaded(),
IPluginAddin.UnLoaded()
end class

If you use delegates, the delegate must be of the same type as the interface
event.

hope this helps..
Imran.

"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:eO**************@tk2msftngp13.phx.gbl...
If I have the interface like this

Interface IPluginAddin
Event Loaded()
Event UnLoaded()
End Interface

I have one class implementing the interface, which also will raise the
events... how in the world do i write an event handler in another class or
form for that event which is in the interface? thanks

Nov 21 '05 #2
Brian,
how in the world do i write an event handler in another class or form for
that event which is in the interface? You would write the event handler exactly the same way as you would if the
Event was in a Class!

You can use either WithEvents or AddHandler.

Public WithEvents plugin As IPluginAddin

Public Sub Main()
Dim plugin As IPluginAddin
AddHandler plugin.Loaded, AddressOf Plugin_Loaded
End Sub

Private Sub Plugin_Loaded()

End Sub

Private Sub plugin_UnLoaded() Handles plugin.UnLoaded

End Sub

Hope this helps
Jay

"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:eO**************@tk2msftngp13.phx.gbl... If I have the interface like this

Interface IPluginAddin
Event Loaded()
Event UnLoaded()
End Interface

I have one class implementing the interface, which also will raise the
events... how in the world do i write an event handler in another class or
form for that event which is in the interface? thanks

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rick Strahl [MVP] | last post by:
I'm working on an app that's using the WebBrowser control. I got the control working fine, hooking to the document object. But I've run into a major issue with hooking the Document events....
7
by: cider123 | last post by:
I'm coding a project using the following article as reference: http://www.codeproject.com/csharp/DynamicPluginManager.asp In this type of project, plugins are loaded dynamically into a Plugin...
2
by: Wiktor Zychla [C# MVP] | last post by:
Hi, suppose there are two interfaces that contain methods with the same name but different signature: interface I1 { void F(); } interface I2 { int F(); } it is then easy to implement...
3
by: HL | last post by:
The requirement is to send some information to other objects. The objects to whom the information has to be sent is not available at compile time. The names of the types (objects) will be provided...
4
by: GTi | last post by:
I have this solution: -> -> A knows about B but not C C knows about B but not A Type A can be a EXE file or NT Service There can be many of type A loaded but not necessarily the same...
13
by: goodoldave | last post by:
Hey everyone, I need some advice concerning Interfaces and delegates. I would like to define a delegate inside of an interface (I know a delegate is a class but hear me out) Here is a...
30
by: Burkhard | last post by:
Hi, I am new to C# (with long year experience in C++) and I am a bit confused by the language construct of events. What is it I can do with events that I cannot do with delegates? At the moment...
2
by: Dan | last post by:
I have need to create a com server that will fire events back to clients. I have looked at some of the documentation and I am new to Python so cant quite get it. I have created an IDL file of the...
1
by: Apu Nahasapeemapetilon | last post by:
Hello and thank you in advance for your help. Can anyone think of a reason why this code would work properly on one PC, but not another? I've got a System.Windows.Forms.UserControl that...
5
by: raylopez99 | last post by:
I understand delegates (static and non-static) and I agree they are very useful, and that the "Forms" used in the Windows .NET API could not work without them. That said, I'm curious as to how...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.