Solved

Help with Panel.Controls.Contains?

Posted on 2002-07-25
4
481 Views
Last Modified: 2008-03-04
How can I deturmine of a Panel contains a form?
0
Comment
Question by:eeevbeee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 23

Accepted Solution

by:
naveenkohli earned 60 total points
ID: 7178163
You can always traverse any control to check for presence of any kind of control.....


if (null != GetFormCtl(panelCtl))
{
 /* Has Form */
}

private Form GetFormCtl(Control parentCtl)
{
 if (prentCtl is Form)
 {
    return (Form)parentCtl;
 }
 Control ctl = null;
 int nCount = parentCtl.Controls.Count;
 for (int i = 0; i < nCount; i++)
 {
   ctl = GetFormCtl(parentCtl.Controls[i];
   if(ctl is Form)
   {  
     break;
   }
 }
 return (Form)ctl;
}
0
 

Author Comment

by:eeevbeee
ID: 7178468
This looks very good, only I can't make out much since I don't speak C# or C++ only VB. Anyway you can do this in VB??


thanks

0
 
LVL 23

Expert Comment

by:naveenkohli
ID: 7179724
I am not a VB person.. but i will give it a shot :-)
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9421019
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by naveenkohli

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheLearnedOne
EE Cleanup Volunteer
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

626 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