VB.net_v03 . tlb

VB.net_v03 . tlb

Anonymous
Not applicable
365 Views
2 Replies
Message 1 of 3

VB.net_v03 . tlb

Anonymous
Not applicable
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
0 Likes
366 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
..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 "Paul Richardson" wrote in message news:4202b014$1_2@newsprd01... > 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 > >
0 Likes
Message 3 of 3

Anonymous
Not applicable
Norman, Works Perfect. Cool too. Thank You, Paul "Norman Yuan" wrote in message news:4202be12$1_3@newsprd01... > .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 > > > "Paul Richardson" wrote in message > news:4202b014$1_2@newsprd01... >> 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 >> >> > >
0 Likes