![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Hobbyist Programmer
Join Date: Jan 2005
Posts: 110
Rep Power: 4
![]() |
Show or hiding forms/modifying control properties ..from different a form..
Hi.
I'm having problems with accessing forms and their properties/functions from different forms, I have a menu (ToolStrip) which has a drop down list for the forms shown, so checking/unchecking the form will hide or show the selected form. Firstly when hiding/showing my forms they don't keep the data that was inputted because I'm calling new forms to be created (I don't know another way to call a form as an 'MdiChild'. Here's the code I'm using to open the form as a child (from the menu of the parent container). if (scriptEditorToolStripMenuItem.Checked == true)
{
Form Script = new TFX_Script();
Script.MdiParent = this;
Script.Show();
}
if (scriptEditorToolStripMenuItem.Checked == false)
{
foreach (Form Script in this.MdiChildren)
{
Script.Hide();
}
}This worked well except for two problems. The data inputted into the form (it's controls.. textboxes, checkboxes etc.) will be gone when the new form is created, I don't want that >_<! The second problem is that obviously the child form can be fully closed within itself via the 'X' button. I don't know how to access the parents menu to change the checkbox (visible or not visible), Also all data will be lost again, I'd rather cancel the close and hide it, while changing the state of the checkbox on the parents menu. Atm, I'm using a not-so-good work around, when the menu is clicked it checks if the form is opened or not, then changes the checkbox in the submenu (for the form) accordingly. foreach (Form Script in this.MdiChildren)
{
if (Script.Visible == false)
{
scriptEditorToolStripMenuItem.Checked = false;
}
else
{
scriptEditorToolStripMenuItem.Checked = true;
}
}If you can help me sort this out it will be greatly appreciated! ![]() Thanks~ -cloud- <_< |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| .NET Timer Form closing issue | MBirchmeier | C# | 4 | Nov 21st, 2005 10:00 AM |
| Show web user control hidden | see07 | C# | 1 | Feb 2nd, 2005 10:35 AM |