Quantcast
Viewing all articles
Browse latest Browse all 21178

Visual Basic “AddressOf expression cannot be converted to long”

I am writing a code to control a portable radio in visual basic and have one single error that is AddressOf' expression cannot be converted to 'Long' because 'Long' is not a delegate type coming from the one line of code below.

Code:

ret = SETCALLBACK(comport, AddressOf IncomingMessageHandler)
which is part of this sub-routine

Dim ret As Byte
Dim comport As Byte
comport = 1      'Use com1
ret = SETCALLBACK(comport, AddressOf IncomingMessageHandler)
'ret = 0 for no error, 1 for com port in use, 2 for no com port

I have googled and read every result on the first 3 pages and cannot find anything that fixes this issue or makes any sense to me. I have been doing visual basic for some time so understand the basics.

Any help with be very much appreciated.

Viewing all articles
Browse latest Browse all 21178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>