SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: Object does not support error when calling a function defined in a class - VBScript

    There are three different classes that you have created BAirSearch, MODULEAirSearchFactory, AAirSearch and you arte trying to execute a function Find which is present B/A class and you are trying to access it in MODULEAirSearchFactory

    your code should be

    Set airSearch = New MODULEAirSearchFactory
    airSearch.getAirSearch().find()

    or

    Set airSearch = New MODULEAirSearchFactory
    set acSearch=airSearch.getAirSearch()
    acSearch.find()

  2. #2
    Member
    Join Date
    Feb 2004
    Location
    India
    Posts
    40
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Object does not support error when calling a function defined in a class - VBScript

    Thanks a lot Tarun, your suggestion is working.
    Karthikeyan A

  3. #3
    Member
    Join Date
    Feb 2004
    Location
    India
    Posts
    40
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Object does not support error when calling a function defined in a class - VBScript

    i am trying to instiantiate a class depending upon a module selected. After the instiantiation, i am trying to call the functions that are part of the instiantiated class. While calling the function, i am getting an error message saying

    "Object doesn't support this property or method: airSearch.find

    Line (118): "airSearch.find()"

    Below is the code snippet for your reference.

    '############################
    MODULE = "A"
    MODULE = "B"

    Class MODULEAirSearchFactory

    Private Sub Class_Initialize
    MsgBox "air search"
    End Sub

    Function getAirSearch ()

    If MODULE = "A" Then
    Set getAirSearch = New AAirSearch
    End If

    If MODULE = "B" Then
    Set getAirSearch = New BAirSearch
    End If

    End Function

    Private Sub Class_Terminate
    'MsgBox Name & ": Goodbye, world!"
    End Sub

    End Class


    Class AAirSearch

    Private Sub Class_Initialize
    MsgBox "hi"
    End Sub


    Public Function find ( )
    MsgBox (" A air search being performed")
    End Function

    Private Sub Class_Terminate
    'MsgBox Name & ": Goodbye, world!"
    End Sub

    End Class


    Class BAirSearch

    Private Sub Class_Initialize
    MsgBox "hi"
    End Sub

    Public Function find ( )
    MsgBox ("B air search being performed")
    End Function

    Private Sub Class_Terminate
    'MsgBox Name & ": Goodbye, world!"
    End Sub

    End Class

    '###############################################

    Set airSearch = New MODULEAirSearchFactory
    airSearch.getAirSearch()
    airSearch.find()
    '################################################
    Karthikeyan A

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 12.50%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 01:49 AM.

Copyright BetaSoft Inc.