Connecting Tech Pros Worldwide Forums | Help | Site Map

Events in dynamic loaded assembly

Martin Falta
Guest
 
Posts: n/a
#1: Nov 13 '05
Hi all,

I need a help with following problem. I need to create a menu from dynamic
loaded assembly on the main form of my application. The menu is created
succesfully, but the events of this menu, which are defined in the dynamic
loaded assembly, are not raised. How can I raise them?

Martin


---
Odchozí zpráva neobsahuje viry.
Zkontrolováno antivirovým systémem AVG (http://www.grisoft.cz).
Verze: 6.0.500 / Virová báze: 298 - datum vydání: 10.7.2003



Gabriele G. Ponti
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Events in dynamic loaded assembly


Martin,

I don't know the details of your application, but when you add a MenuItem to
your menu you can specify the event handler:

mnu.MenuItems.Add("Item 1", New EventHandler(AddressOf mnu_Click))

If this doesn't work for you because you can get the address of the
procedure, you can use a common procedure for all the MenuItems events, then
using the Index property of the sender object you can at least find out what
was selected and take the appropriate actions.

For example:

' add items
mnu.MenuItems.Add("Item 1", New EventHandler(AddressOf mnu_Click))
mnu.MenuItems.Add("Item 2", New EventHandler(AddressOf mnu_Click))
mnu.MenuItems.Add("Item 3", New EventHandler(AddressOf mnu_Click))

Protected Sub mnu_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)

Dim i As Integer

' get index
i = sender.Index

' do something with i
' ...

End Sub

HTH,

Gabriele

"Martin Falta" <martin.falta@atlas.cz> wrote in message
news:eLZkyFSSDHA.2128@TK2MSFTNGP12.phx.gbl...[color=blue]
> Hi all,
>
> I need a help with following problem. I need to create a menu from dynamic
> loaded assembly on the main form of my application. The menu is created
> succesfully, but the events of this menu, which are defined in the dynamic
> loaded assembly, are not raised. How can I raise them?
>
> Martin
>
>
> ---
> Odchozí zpráva neobsahuje viry.
> Zkontrolováno antivirovým systémem AVG (http://www.grisoft.cz).
> Verze: 6.0.500 / Virová báze: 298 - datum vydání: 10.7.2003
>
>[/color]


Closed Thread