all groups > vb.net upgrade > september 2005 >
You're in the

vb.net upgrade

group:

To convert 'As Any' in VB6 to .NET


To convert 'As Any' in VB6 to .NET Beginner
9/15/2005 2:09:01 PM
vb.net upgrade:
Hello,
I hope this is the right place to ask this question.

When I tried to convert my VB 6.0 program to .Net, I got an error message
that says, "Declare statement does not support parameters of type As Any".

Here is the part that the error msg indicates;
Public Declare Function TestComunication Lib "TestDll" (ByVal hDev As Long,
ByVal ComCode As Long, ByRef SendData As Any, ByVal SendDataNum As Long,
ByRef ReceiveData As Any, ByVal ReceiveDataNum As Long) As Long

I used 'As Any' as type of 'SendData' and 'ReceiveData' in VB6.0 because the
'TestCommunication' function is called by a lot of different function and
pass the different type of argument (can be long, integer, UDT etc...)

How can I get rid of the error msg and pass the argument with the correct
type?
Thanks in advance.

Re: To convert 'As Any' in VB6 to .NET Herfried K. Wagner [MVP]
9/15/2005 11:19:56 PM
"Beginner" <Beginner@discussions.microsoft.com> schrieb:
[quoted text, click to view]

Simply declare multiple versions of the function (you can even use the same
name for each of the overloaded versions) and specify explicit types instead
of 'As Any', which is not longer supported.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
AddThis Social Bookmark Button