how can get windows usercontrols from RunTime ganerater Form

M

Mian Mahboob

Nicholas Paldino
in my application a have an Windows form on that i place an Panel Control.
in Form
load event i ganerate an Form in Panel Control on Runtime then get an design
time
create user-control (textbox, 2 buttons) in Runtime Form Runtime Form may
be contain
more then 1 same or difreant User Controls.

i want to get all the User controls on that Runtime Form as i can use that
controls
the code which do that mean getting user-controls is in one User Controls
because
user-controls is main key to perform this in user-control i do other more
things

the senario which is i'm thinking is when the usercontrols are place on
RunTime form
in the last User Control is placeed on this then it get the it's Parent Form
that
should be RunTime Form then get all it's Child Controls which will be
User-controls
which are placed on it as we can use that all controls i think will woking
through
Reflecion

the problem i'm face that i cann't that RunTime Form and it's Childs control
as
workable
for handling events i place that body of event procedure that use that
through

userControls's control or some other way
 
R

raj

if i understand correctly you are trying to get list of all controls in the
panel control

you can try the the controls list

this will traverse (loop) through all the controls

foreach (Control ctrl in myPanel.Controls)
{
//here you can see if its the control you need.
if(ctrl is myCustomControlOne )
{
//take some action
}

}

hth

raj
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top