DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links