473,396 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

MdiChildren

28
hello Im working on MDI form application.

I have one problem i need to know when the mdi child cclosing, and need to know him name or .text.

how i can do this. How I can get it ?

Or how I can use MdiChildActivate event to get it.

thx
Dec 15 '09 #1
2 2598
Although not 100%, this code may help you.

Expand|Select|Wrap|Line Numbers
  1. public partial class MDIForm : Form
  2.     {
  3.         public string Message
  4.         {
  5.             get { return this.textBox1.Text; }
  6.             set { this.textBox1.Text = value; }
  7.         }
  8.  
  9.         public MDIForm()
  10.         {
  11.             InitializeComponent();
  12.         }
  13.  
  14.         int cout = 0;
  15.         private void btnCreateChild_Click(object sender, EventArgs e)
  16.         {
  17.             ChildForm f = new ChildForm(cout.ToString());
  18.             f.MdiParent = this;
  19.             f.Show();
  20.             ++cout;
  21.         }
  22.     }
  23. public partial class ChildForm : Form
  24.     {
  25.         public ChildForm(string name)
  26.         {
  27.             InitializeComponent();
  28.             this.Text = name;
  29.         }
  30.  
  31.         private void ChildForm_FormClosing(object sender, FormClosingEventArgs e)
  32.         {
  33.             MDIForm f = this.ParentForm as MDIForm;
  34.  
  35.             if (f != null)
  36.             {
  37.                 f.Message = "Child " + this.Text + " is just closed";
  38.             }
  39.         }
  40.     }
  41.  
  42. static class Program
  43.     {
  44.         /// <summary>
  45.         /// The main entry point for the application.
  46.         /// </summary>
  47.         [STAThread]
  48.         static void Main()
  49.         {
  50.             Application.EnableVisualStyles();
  51.             Application.SetCompatibleTextRenderingDefault(false);
  52.             Application.Run(new MDIForm());
  53.         }
  54.     }
  55.  
Here is the picture:

Dec 16 '09 #2
BbEsy
28
Thx, I solve this yesterday.

I solve it another way.

Expand|Select|Wrap|Line Numbers
  1. public void MDI_Child_closing(string strID)
  2. {
  3. any action
  4. }
  5.  
  6. private void TestChild_FormClosing(object sender, FormClosingEventArgs e)
  7. {
  8. ((Form1)this.MdiParent).MDI_Child_closing(this.Text);
  9. }
  10.  
Dec 16 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ron L | last post by:
I have an MDI application which opens a number of child windows, each of which could have data in a state that needs to be saved. Each child window catches its Closing event and cancels it if the...
3
by: Soul | last post by:
Hi, I have multiple Mdi child forms within a parent form. All Mdi child forms will have one DataGrid on it, the DataGrid is bind to a DataView and the DataView is again bind to a DataTable. In...
3
by: James Spibey | last post by:
Hi, I have an MDI application which has aboout 10 child windows. The way the app needs to work is that only one window should be visible at a time and it should be maximized within the parent...
1
by: Adi | last post by:
Hi I got problem with Mdi form, I would like to check if child form is already created and opened (I have a few child forms). And if it is open to make it focus else create new instance of the...
4
by: DraguVaso | last post by:
Hi, I have a Form which has the property IsMdiContainer = True. So it contains a whole bunch of MdiChilds. Those MdiChilds are all instances of two forms I have: I have some that are an instance...
28
by: Maarten | last post by:
hi all, i have a settingform(form4) this form opens from an mdi parent form1 what i want do do is, when i make change in form4 (adjust settings), then a listview in the mdi parent form1...
2
by: carmelo.orlando | last post by:
Hi to all, Im a new user of this group. I have a mdiParent form with a toolbar that contains some buttons. One of this button have to activate the function "click" of a button located into the mdi...
11
by: Kevin | last post by:
I've got a timer on my MDI parent form. If there's no mouse movement for a set number of minutes, the Visible property of all open forms is set to False and the Log On form is displayed. I could do...
11
by: Andrus | last post by:
Managed code .NET 3.5 C# WinForms application runs OK from Vista when in local drive. When application is copied to mapped network drive or started from \\othercmp\c\myapp\myapp.exe folder , it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.