Results 1 to 4 of 4

Thread: Test if Object Property Exists

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Posts
    123

    Test if Object Property Exists

    I am working on a program that investigates the DOM object, mostly as a learning process for myself.

    My program displays characteristics of an element that it finds, but in the DOM, the attributes ie 'Name' are not consistent for all types of elements (Tags).

    Is there a test to check for the presence of a given property, method etc that I can make beforehand to avoid generating errors when I try to retrieve the data in a generalized routine?

    It seems there would be a method that would apply to objects in general.

    Thanks in advance.

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    You can use error trapping to ensure that the error doesn't crash your app, and then if an error occurs, print out something and then continue to the next attempt.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Posts
    123
    Yes, thought of that, just seems like a back door approach to what should be a common question when dealing with objects that are you are not real familiar with.

  4. #4
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Well the developer's the only person that'll ever need to use them, so either get the spec. from the developer of the object, or early bind to the object if possible...

    ... of course, all this is academic if you use .NET because you can use xml web services
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

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