Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export the objects of a form from another form

Status
Not open for further replies.

swreng

MIS
Jun 22, 2006
90
GR
Dear all,

I have an application with many forms as mdichildren on an mdi parent form
And i want to make a new form which do the following:

1. take a name of a form

2. pressing a button and exports all the objects (names) of the form given in a file.

I used the following code on the button click:

System.Windows.Forms.Form[] frms=frmMain.MdiChilldren;
for(i=0;i<frms.Length;i++)
{
if (frms.Name="given name")
{
System.Windows.Forms.Control.ControlCollection ctl=new System.Window.Forms.Control.ControlCollection(frms
for(j=0;j<ctl.Count;j++)
{
// Write to the file

}
}
}


Now The problem is the following:

1. In Order to fill the frms collection it is nessecary the form that i must export the objects be loaded

2. Even if the form is loaded the ControlCollection ctl doesn't filled.



So How can i fill the formcollection without be loaded and how will i fill the ctl controlcollection?


The above code is working perfect when i fill the ctl as
System.Windows.Forms.Control.ControlCollection ctl=new System.Window.Forms.Control.ControlCollection(this)


Many Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top