Check Whether A Panel Has No Controls Inside (Is Empty)

Posted on 2012-09-06
Last Modified: 2012-09-06

I'm working in a VB.NET Windows project that contains a panel. The user adds records to this panel by selecting an item from a combo box outside this panel. The records get added to the panel in textboxes.  When the user is done, they submit the record(s) in the panel to the database by hitting a button below the panel.  

I want to check whether the user has added any records in the panel before submitting them to the database.  I'm hoping to have something in the button that checks whether the panel is empty ( it has no records  = no textboxes) before submitting.  

Does anyone know how to check whether a panel has no controls in it?

Question by:TheUndecider
    LVL 83

    Accepted Solution

    Check the Panel.Controls.Count property
    LVL 85

    Expert Comment

    by:Mike Tomlinson
    There's also a HasChildren() property:


        If Panel1.HasChildren() Then

        End If

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now