To check if a control exists in the form


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: To check if a control exists in the form

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    To check if a control exists in the form

    [Originally posted by Biju]

    Dear all,
    I am generating controls (say Labels) at runtime in VB. Before loading any control I want to see if the control has been already loaded or not. An error message comes when I try to load an existing control. How to check whether a control already exists in the form or not? Thanks.
    Biju.

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:To check if a control exists in the form

    [Originally posted by gibra]

    Choose one:

    1st:
    On Error Resume Next
    Load Your_Control_Name
    If Err.Number =361 Then
    ' Your control is already
    Err.Clear
    End If

    2nd:
    If Your_Control_Name Is Nothing Then
    Load Your_Control_Name
    End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center