Using Delegates (More Info)

  • Thread starter Thread starter Billy Jacobs
  • Start date Start date
B

Billy Jacobs

I forgot to capitalize the line causing the error. It is:

printer.PrintCallback(10)
 
now it makes a little more sense although i still think your approach is
wrong (improper use of delegates)

try this on the problem line:
printer.PrintCallback.Invoke(10)
 
now it makes a little more sense although i still think your approach is
wrong (improper use of delegates)

try this:

in your original code replace:
printer.PrintCallback = New PrintCallback
(AddressOf driver.PrintInteger)
printer.PrintCallback(10)

with:
printer.PrintCallback = AddressOf driver.PrintInteger
printer.PrintCallback.invoke(10)
 
Hi Billy,

Kairi is correct that you should call the delegate object's Invoke method.
In the meantime, I believe the following MSDN articles are helpful:

HOW TO: Use Single and Multicast Delegates in Visual Basic .NET
http://support.microsoft.com/?id=322188

An Introduction to Delegates
http://msdn.microsoft.com/msdnmag/issues/01/04/net/default.aspx

Please feel free to let me know if you have any problems or concerns.

Have a nice day! :-)

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top