Results 1 to 8 of 8

Thread: Checking if somethng is Nothing

  1. #1

    Thread Starter
    Fanatic Member Geespot's Avatar
    Join Date
    Oct 2001
    Location
    Birmingham, UK
    Posts
    577

    Checking if somethng is Nothing

    Hi

    How can i check to see if an UDT array is nothing?

    Thanks

  2. #2
    Fanatic Member
    Join Date
    Feb 2002
    Location
    SE England
    Posts
    732
    Dim lTemp as long

    On Error Resume Next

    lTemp = LBound(MyUDTArrray)

    If Err.Number <> 0 Then
    msgbox "MyUDTArray has not been dimensioned!"
    end if

    On Error Goto 0
    Leather Face is comin...


    MCSD

  3. #3

    Thread Starter
    Fanatic Member Geespot's Avatar
    Join Date
    Oct 2001
    Location
    Birmingham, UK
    Posts
    577
    Thanks for your reply, but anyone know another way?
    Im sure theres a way you can do it like

    If UDTarray = nothing or similar

  4. #4
    Addicted Member Screamager's Avatar
    Join Date
    May 2001
    Location
    Dublin, Ireland
    Posts
    174
    Well, with objects you can do

    VB Code:
    1. if theObject is nothing then
    2.     'do whatever
    3. end if

    I'm pretty sure that won't work with UDT's though
    Computer /nm./: a device designed to speed and automate errors

  5. #5

  6. #6
    Fanatic Member
    Join Date
    Feb 2002
    Location
    SE England
    Posts
    732
    Arrays are not objects, and therefore can not be compared to nothing...

    Think about it, you never do:

    Set MyArray = New Array

    Do you? so the array IS NOT AN OBJECT.. and will never ever, ever ever ever ever ever ever ever ever ever ever ever ever ever be nothing...

    I assumed when you said nothing in relation to an array you mean that it had not been dimensioned.. This is the closest to nothing an array will ever get.
    Leather Face is comin...


    MCSD

  7. #7

    Thread Starter
    Fanatic Member Geespot's Avatar
    Join Date
    Oct 2001
    Location
    Birmingham, UK
    Posts
    577
    Thanks for your replies, i understand arrays are not objects, its just that when an array is not dimensioned, vb (in a tooltip) pops up the word 'nothing' when my mouse if hovered over the array, so i just thought maybe you could check it like you could with objects.

    Ohwell, the On error will do fine, just i didnt want to do that if there was a simpler way

    Thanks

  8. #8
    Addicted Member WALDO's Avatar
    Join Date
    Aug 2002
    Location
    Swing of Prussia, PA
    Posts
    244
    VB Code:
    1. If IsArray([i]MyArray[/i]) Then ...

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