Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2004

    Unanswered: visual basic pro 6. variable question


    I am using Visual Basic pro ver 6.0. Please see attached the project file
    I defined in module1 a type variables as:

    Type blox
    name As String
    ind As Integer
    Lx As Double
    Ly As Double
    Lz As Double
    x0 As Double
    y0 As Double
    z0 As Double
    material As String
    assigninside As Boolean
    xcolor As String
    transparency As Double
    End Type

    In the same module, I define:

    Global blocks() As blox

    Then, in the main Form1 I have


    Redim blocks(n)

    and then

    for i=1 to n

    call fun(blocks(i))

    next i
    When it gets to the line
    "Call Create_Box_and_Assign_Material(pfln, blocks(indi))"
    I get the following error message

    "only user-defined types in public object modules can be coerced to or from a variant or passed to late bound functions"

    any ideas on how to fix this?

    Thank you

  2. #2
    Join Date
    Jun 2004
    Arizona, USA
    Try this:
    Public Type Blox
      name As String
      ind As Integer
      Lx As Double
    End Type
    Public blocks() As blox
    The Global keyword was deprecated with, I believe, VB5, and is only included for backwards compatibility in later versions. Public should be used with VB6.
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert

Posting Permissions

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