473,324 Members | 2,473 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,324 software developers and data experts.

Dynamic discovery of delegates

Help please, I need a genius!!!

[I'm using VB.NET 2003]

I have an application that loads assemblies at runtime. These assemblies
have many classes (objects) and some do have several delegates. I want to be
able to discover a delegate on an object, and to be able to programmatically
assign it to a callback address.

In my app, I have an object with delegate defined as follows:

public delegate StringChanged(strNewValue as string)
private myStringChangedDelegate as StringChanged

I then have a method to assign a callback to this delegate, such as:

public sub AddListenerToStringChanged(callback as StringChanged)
myStringChangedDelegate = .... ' you know the drill here...
end sub
The thing is, I can (at runtime) detect the above procedure, but I want I
want to do is to programmatically assign a callback address to this...
something along the lines of:

myObject.AddListenerToStringChanged(addressof obj2.StringChangedListener)
I am guessing that I need to use some kind of "MethodInvoke" or something?
but it's the "Addressof" operator that gets me... I just can't find the
information or the syntax that the compiler will accept.

In summary, my question is:
How do I invoke a method which requires an Addressof operator?

Any help would be truly appreciated. Thanks.
Nov 20 '05 #1
1 1035

If you want to dynamically create a delegate of a type that's unknown
at compile time, use System.Delegate.CreateDelegate().

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 20 '05 #2

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

Similar topics

0
by: Nate | last post by:
Help please, I need a genius!!! I have an application that loads assemblies at runtime. These assemblies have many classes (objects) and some do have several delegates. I want to be able to...
0
by: Anurag | last post by:
Hi, I understand that the dbm cfg parameter "DISCOVER" controls whether Search or Known discovery is applicable. Additionally, Search discovery provides a superset of Known discovery. I completely...
6
by: jason | last post by:
hello everyone, is there any way in C# to perform dynamic property discovery? i know such a thing was possible in C++ template code, but it was kind of an ugly mess. i'm just curious if there is...
0
by: Chris | last post by:
Hi, I have created a vsdisco-file on a webserver (http://MyHost/MyWebServices/test.vsdisco), activated dynamic-discovery by adding an entry in <httpHandlers> in machine.config. But then what...
2
by: Mark Broadbent | last post by:
I had a requirement to code dynamic delegates, so they attach detach from the button as needed ... then after time realised that the button is not retaining it's click handlers. To circumvent this...
15
by: Nak | last post by:
Hi there, Is it possible to load a web service dynamically? i.e. If the web service were to exist on a system with a non static IP address, an application could download a "locator" file that...
7
by: Mike Livenspargar | last post by:
We have an application converted from v1.1 Framework to v2.0. The executable references a class library which in turn has a web reference. The web reference 'URL Behavior' is set to dynamic. We...
7
by: Chris Mullins | last post by:
I'm in the process of building a number of (Web) Services using .NET 3.0 and WCF. These services are intended to be deployed within the Intranet of a very, very large orginization. I need to...
2
by: HockeyFan | last post by:
I have a web service that has been working, but I recently changed it so that the reference would be dynamic. Locally, within Visual Studio, it works fine. However, once deployed, the dll I use...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.