Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Help with Panel.Controls.Contains?

Posted on 2002-07-25
4
Medium Priority
?
483 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 240 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

705 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