Results 1 to 2 of 2

Thread: how: user-defined datatype as method argument?

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    2
    I'm using VB6.
    Can anyone please tell me how would it be possible for me to have a
    CLASS METHOD that has a public USER-DEFINED DATATYPE as one of its
    arguments.

    Example:
    '-----In a public module (.BAS)
    Public Type POINTAPI
    x As Long
    y As Long
    End Type

    '-----In a class (.CLS)
    Public Sub GetPoints(ByRef numOfPoints As Integer, _
    ByRef floorPoints() As POINTAPI)

    - The method declaration above will generate the following error :
    "Only public user defined types defined in public object modules can
    be used as parameters or return types for public procedures of class
    modules or as fields of public iuser defined types"
    - Is there a way to get around with such problem?

  2. #2
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Hi,
    The way I work around this one is to not use a normal module for the UDT but another class module of their own. Then setting the Instancing property to 2-PublicNotCreateable means that they are global to your code but cannot be seen when compiled. This probably isn't the correct way, but it works for me

    Hope this helps,

    Shaun
    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width