VB.Net-FORM - Opposite of 'Is Nothing'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abev
    New Member
    • Jan 2008
    • 22

    VB.Net-FORM - Opposite of 'Is Nothing'

    I am checking to see if a form is already set to an instance but I have only been able to do this backwards. What is the opposite of this statement?

    Code:
               
     'Hide IO form
    If Main.myinsertorder Is Nothing OrElse Main.myinsertorder.IsDisposed Then
    
    Else
         Main.myinsertorder.Hide()
    End If
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Why? It's doing exactly what you want?
    The opposite of nothing is anything.
    That would be a LOT of if statements if you wanted to check if it was ANYTHING.

    Comment

    • abev
      New Member
      • Jan 2008
      • 22

      #3
      Originally posted by Plater
      Why? It's doing exactly what you want?
      The opposite of nothing is anything.
      That would be a LOT of if statements if you wanted to check if it was ANYTHING.
      It is doing exactly want I want Plater, thanks.

      My only concern was I thought it was bad practice to have a statement where the 'true' portion of the IF statement was empty?

      Comment

      • leoiser
        New Member
        • Jul 2007
        • 41

        #4
        Check this

        Not (Main.myinserto rder Is Nothing)

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #5
          Originally posted by leoiser
          Check this

          Not (Main.myinserto rder Is Nothing)
          Indeed. It's all in how you arrange it.

          Checking for null (Nothing in VB) is a pretty vital part of an error free application, so it's good that you're doing it.

          Comment

          Working...