?
Solved

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

Posted on 2012-09-06
2
Medium Priority
?
586 Views
Last Modified: 2012-09-06
Hello,


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?

Thanks.
0
Comment
Question by:TheUndecider
2 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 38373321
Check the Panel.Controls.Count property
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 38373681
There's also a HasChildren() property:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.haschildren.aspx

So:

    If Panel1.HasChildren() Then

    End If
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

809 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