PC Review


Reply
Thread Tools Rate Thread

'AddressOf' expression cannot be converted to 'Integer' because 'Integer'is not a delegate type.

 
 
Patrick Dugan
Guest
Posts: n/a
 
      13th Mar 2005
I am *trying* to convert a VB6 program to vb.net. One error I am getting
that I cannot figure out is:

'AddressOf' expression cannot be converted to 'Integer' because
'Integer' is not a delegate type.

This is the offending line where the error is located:

res = UUIRTSetReceiveCallback(hDrvHandle, AddressOf IRReceiveCallback, Me)

This is the sub routine it is calling from the "AddressOf"

Public Sub IRReceiveCallback(ByVal IRCode As Integer, ByVal userData As
Integer)
Call PostMessage(frmMain.NewPtr, WM_GOT_RECEIVE, 0, IRCode)
End Sub


How can I modify this to use a "delegate"?
 
Reply With Quote
 
 
 
 
gaidar
Guest
Posts: n/a
 
      13th Mar 2005
Look through this article, please:
http://msdn.microsoft.com/library/de...raddressof.asp

"Patrick Dugan" <(E-Mail Removed)> wrote in message
news:ekbHW6%(E-Mail Removed)...
>I am *trying* to convert a VB6 program to vb.net. One error I am getting
>that I cannot figure out is:
>
> 'AddressOf' expression cannot be converted to 'Integer' because 'Integer'
> is not a delegate type.
>
> This is the offending line where the error is located:
>
> res = UUIRTSetReceiveCallback(hDrvHandle, AddressOf IRReceiveCallback, Me)
>
> This is the sub routine it is calling from the "AddressOf"
>
> Public Sub IRReceiveCallback(ByVal IRCode As Integer, ByVal userData As
> Integer)
> Call PostMessage(frmMain.NewPtr, WM_GOT_RECEIVE, 0, IRCode)
> End Sub
>
>
> How can I modify this to use a "delegate"?



 
Reply With Quote
 
=?Utf-8?B?Q3JvdWNoaWUxOTk4?=
Guest
Posts: n/a
 
      14th Mar 2005
The AddressOf will only take a name without parameters.. Example:

Dim t As New Ststem.Threading.Thread(AddressOf DoSomething) ' ok

Dim t As New Ststem.Threading.Thread(AddressOf DoSomething(i As Integer)) '
error

All you need to do is create your delegate:

Delegate sub SomeName (IRCode As Integer, userData As Integer)

Then you can create your sub. Example

Private Sub SomeSub (iNumber As Integer, iNumber2 As SomeName) 'Use Delegate
....
End Sub
 
Reply With Quote
 
Patrick Dugan
Guest
Posts: n/a
 
      14th Mar 2005
Thanks! The example that was mentioned previously wasn't much help. I
appreciate the assistance!

"Crouchie1998" <(E-Mail Removed)> wrote in message
news:6E5757AD-3300-4121-BA9C-(E-Mail Removed)...
> The AddressOf will only take a name without parameters.. Example:
>
> Dim t As New Ststem.Threading.Thread(AddressOf DoSomething) ' ok
>
> Dim t As New Ststem.Threading.Thread(AddressOf DoSomething(i As Integer))
> '
> error
>
> All you need to do is create your delegate:
>
> Delegate sub SomeName (IRCode As Integer, userData As Integer)
>
> Then you can create your sub. Example
>
> Private Sub SomeSub (iNumber As Integer, iNumber2 As SomeName) 'Use
> Delegate
> ...
> End Sub



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Diff bw Small integer and Capitol integer vijjirams@gmail.com Microsoft ASP .NET 0 17th Sep 2008 03:41 PM
converted integer to string criteria Don Cossitt Microsoft Access Queries 1 24th Oct 2005 05:16 PM
Value of type 'Integer' cannot be converted Jim in Arizona Microsoft VB .NET 2 31st Jan 2005 10:22 PM
Addressof cannot be converted to integer =?Utf-8?B?SHV0dHk=?= Microsoft Dot NET Framework 7 30th Nov 2004 01:29 PM
Can't create Integer field, a Long Integer is created instead? cbu Microsoft Access Database Table Design 1 2nd Jan 2004 04:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:27 AM.