Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB.net - Checking for the instance of a control

VB.net - Checking for the instance of a control

Scheduled Pinned Locked Moved Visual Basic
csharptutorialquestion
3 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pkrvb
    wrote on last edited by
    #1

    I am trying to find out how to check to see if a control exists (such as a listbox). If it does, then the program wouldn't do anything, if it doesn't, then the program would create it. Does anyone know how to do this or can point me in the right direction?

    CPalliniC D 2 Replies Last reply
    0
    • P pkrvb

      I am trying to find out how to check to see if a control exists (such as a listbox). If it does, then the program wouldn't do anything, if it doesn't, then the program would create it. Does anyone know how to do this or can point me in the right direction?

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      Why don't you use a variable to hold the reference to the listbox and set it to Nothing whenever it isn't instantiated?

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      [my articles]

      In testa che avete, signor di Ceprano?

      1 Reply Last reply
      0
      • P pkrvb

        I am trying to find out how to check to see if a control exists (such as a listbox). If it does, then the program wouldn't do anything, if it doesn't, then the program would create it. Does anyone know how to do this or can point me in the right direction?

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        You should really be checking for the existance of the piece of data that triggered the control being created, not checking for the control itself.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups