Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Oct 20th, 2006, 11:03 AM   #1
cloud-
Hobbyist Programmer
 
Join Date: Jan 2005
Posts: 110
Rep Power: 4 cloud- is on a distinguished road
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();
                }

            }
TFX_Script is the child form.

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;
                }
            }
This doesn't look too good since you can see the check (in the menu) flash and it doesn't fix my other problem with loosing the data also.

If you can help me sort this out it will be greatly appreciated!
Thanks~

-cloud- <_<
cloud- is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:06 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC