Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

'As Any' is not supported in 'Declare' statements

The Any data type was used with Declare statements in Visual Basic 6.0 and earlier versions to permit the use of arguments that could contain any type of data. Visual Basic supports overloading, however, and so makes the Any data type obsolete.

Error ID: BC30828

To correct this error

  1. Declare parameters of the specific type you want to use; for example.

    Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" ( _
        ByVal lpBuffer As String, _
        ByRef nSize As Integer) _
        As Integer
    
  2. Use the MarshalAsAttribute attribute to specify As Any when Void* is expected by the procedure being called.

    Declare Sub SetData Lib "..\LIB\UnmgdLib.dll" ( _
        ByVal x As Short, _
        <System.Runtime.InteropServices.MarshalAsAttribute( _
            System.Runtime.InteropServices.UnmanagedType.AsAny)> _
            ByVal o As Object)
    
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft