Results 1 to 1 of 1

Thread: COM object doesn’t support property or method

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Posts
    3

    Exclamation COM object doesn’t support property or method

    Hi
    I've created ActiveX.EXE COM server (TestComp2) that has 2 classes
    1. cls1 that Ipmplements IDescriptionSet interface
    2. cls2 that Imlements IDescription interface

    When I declare a variable of the appropriate interface it gives me an
    access to the property “Text” such as
    Dim oDS As IDescriptionSet
    Set oU = CreateObject("TestComp2.cls1")
    Print oO.Item(1).Text
    But when I declare a variable of type "Object" it gives me an error:
    "Run - Time error 483 object doesnt support this property or method" such as:
    But object does support oO.Item(1).IDescription_Text

    Dim oO As Object
    Dim oDSet As IDescriptionSet

    Set oDSet = CreateObject("TestComp2.cls1")
    Set oO = oDSet
    Print oO.Item(1).Text < -Run - Time error 483 object doesn’t support this property or method"

    The code example is down below.
    If you know why the object is looking for "IDescription_Text" instead of "Text" property please let me know.
    Thanks.
    '-----------ActiveX.EXE server ----------------------------------
    Project name "TestComp2"
    cls2
    Option Explicit
    Implements IDescription

    Private Property Get IDescription_Text() As String
    IDescription_Text = "Yaba - Daba - Dooo"
    End Property
    '----------------------------------------------------------------------------------

    cls1
    Option Explicit
    Implements IDescriptionSet
    Private Property Get IDescriptionSet_Item(ByVal vIndex As Variant) As IDescription
    Dim oDescription As cls2

    Set oDescription = New cls2
    Set IDescriptionSet_Item = oDescription
    End Property

    '----------------------------------------------------------------

    ' ------------- Client ---------------
    Option Explicit
    Dim oU As IUnknown
    Dim oDSet As IDescriptionSet
    Dim oD As IDescription
    Dim oO As Object

    Private Sub Cmd_Click()

    Set oU = CreateObject("TestComp2.cls1")
    Set oDSet = oU

    Set oO = oDSet

    Print oO.Item(1).Text <-Run - Time error 483 object doesn’t support this property or method

    Set oU = Nothing
    Set oO = Nothing
    Set oDSet = Nothing

    End Sub

    But object does support oO.Item(1).IDescription_Text - Why ?
    Last edited by sashakli; Mar 4th, 2004 at 09:28 AM.

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