By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,238 Members | 1,485 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,238 IT Pros & Developers. It's quick & easy.

Proxy Event Class

P: n/a
Hi,

What I am looking to do is call a function which will generate an object based on its passed parameters, add it to another control and when the generated item is clicked pass the event back to the calling class by using Addressof (if that makes any sense)

I came up with: -

Public Shared Function AddTaskItem(ByVal p_Label As String, ByVal p_Icon As Icon, ByRef callback As System.EventHandler) As Boolean

Dim pTaskItem As New mdobler.XPCommonControls.XPLinkedLabelIcon
Dim oItemTemp() As mdobler.XPCommonControls.XPLinkedLabelIcon
pTaskItem.Text = p_Label
pTaskItem.Icon = p_Icon
pTaskItem.Tag = callback

AddHandler pTaskItem.Click, callback

oTaskContainer.Controls.Add(pTaskItem)

End Function

I was calling this function (from a seperate class) by: -

Plugins.Extensions.AddTaskItem("Test", Nothing, AddressOf myclickhandlerfunction)

It runs with no errors however no event gets passed to myclickhandlerfunction it looks like it looses the event as soon as the AddTaskIten function completes.

Any help is greatly appreciated.

Cheers

Paul Trippett
Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.