VB.net_v03 . tlb

Discussion in 'AutoCAD' started by Paul Richardson, Feb 3, 2005.

  1. I made a simple test Class in vb.Net which
    works fine in .net as a Member or compiled
    Reference.

    Using the command line [regasm] I successfully
    registered the dll and created a .tlb, which
    is now available as a Reference in VBA.

    I can create a new instance of the Class in vba
    but none of the properties are available in the
    browser or via intellisence. I don't get an error when
    the class is instantiating but if I force in a property
    I get a runtime error, which is expected since they are
    not there.

    Any ideas? Is it Possible?

    Thanks,
    Paul

    '***Start Code
    'Imports System.Math
    'Commented out in compiled version for VBA
    'Now the c = a^2 + b^ Theorem

    Public Class clsPythagoreanTheorem
    Private dblA As Double
    Private dblB As Double
    Private dblC As Double

    Public Property dblAValue() As Double
    Get
    Return dblA
    End Get
    Set(ByVal Value As Double)
    dblA = Value
    End Set
    End Property

    Public Property dblBValue() As Double
    Get
    Return dblB
    End Get
    Set(ByVal Value As Double)
    dblB = Value
    End Set
    End Property

    'For testing only..Actual version would have Set..
    Public ReadOnly Property dblCValue() As Double
    Get
    dblC = fCalcTheorem()
    Return dblC
    End Get
    End Property

    Private Function fCalcTheorem()
    'Comment out math Namespace can't use sqrt
    'fCalcTheorem = Sqrt((dblA ^ 2) + (dblB ^ 2))
    fCalcTheorem = ((dblA ^ 2) + (dblB ^ 2))
    End Function

    End Class
    '***End Code
     
    Paul Richardson, Feb 3, 2005
    #1
  2. Paul Richardson

    Norman Yuan Guest

    ..NET component for COM Interop does not support IntelliSense in VB/VBA. It
    is by design. To work around this, you need to do some extra work, such as
    defining a public interface, implementing the object with the interface,...
    See following link:

    http://support.microsoft.com/default.aspx?scid=kb;en-us;813809
     
    Norman Yuan, Feb 4, 2005
    #2
  3. Norman, Works Perfect. Cool too.

    Thank You,
    Paul
     
    Paul Richardson, Feb 4, 2005
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.