[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

02/13/2004 at 04:29PM PST, ID: 20884593
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

A child-parent problem

Asked by cemlouis in C# Programming Language

Hi to all,

I have 3 dialogs which are Parent, Dialog and Child. When I press My Parent dialog's menu I come across with my dialog box. Everything ok for now. But when I press the button on dialog I want my child dialog inside the parent dlg box. I think I made something wrong the code runs without any errors but doesn't make what I want??? Might be a logic failure in somewhere. This trashed all my day (I brainstrom and checked lots of articles about forms...) But couldn't get a result. So any help would be greatly appreciated. I am posting all my 3 file(Sorry for the pollution)

Thank you,
Cem Louis

/////////////
//Parent.cs//
/////////////

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Test1
{
      /// <summary>
      /// Summary description for Parent.
      /// </summary>
      public class Parent : System.Windows.Forms.Form
      {
            private System.Windows.Forms.MainMenu mainMenu1;
            private System.Windows.Forms.MenuItem menuItem1;
            private System.Windows.Forms.MenuItem menuItem2;
            /// <summary>
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.Container components = null;

            public Parent()
            {
                  //
                  // Required for Windows Form Designer support
                  //
                  InitializeComponent();

                  //
                  // TODO: Add any constructor code after InitializeComponent call
                  //
            }

            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            protected override void Dispose( bool disposing )
            {
                  if( disposing )
                  {
                        if (components != null)
                        {
                              components.Dispose();
                        }
                  }
                  base.Dispose( disposing );
            }

            #region Windows Form Designer generated code
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                  this.mainMenu1 = new System.Windows.Forms.MainMenu();
                  this.menuItem1 = new System.Windows.Forms.MenuItem();
                  this.menuItem2 = new System.Windows.Forms.MenuItem();
                  //
                  // mainMenu1
                  //
                  this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                                                                this.menuItem1});
                  //
                  // menuItem1
                  //
                  this.menuItem1.Index = 0;
                  this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                                                                this.menuItem2});
                  this.menuItem1.Text = "Show Dialog";
                  //
                  // menuItem2
                  //
                  this.menuItem2.Index = 0;
                  this.menuItem2.Text = "Show!";
                  this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
                  //
                  // Parent
                  //
                  this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
                  this.ClientSize = new System.Drawing.Size(292, 273);
                  this.IsMdiContainer = true;
                  this.Menu = this.mainMenu1;
                  this.Name = "Parent";
                  this.Text = "Parent";

            }
            #endregion

            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main()
            {
                  Application.Run(new Parent());
            }

            private void menuItem2_Click(object sender, System.EventArgs e)
            {
                  Test1.Dialog Dialog = new Test1.Dialog();
                  Dialog.Show();
            }
      }
}

/////////////
//Dialog.cs//
/////////////

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Test1
{
      /// <summary>
      /// Summary description for Dialog.
      /// </summary>
      public class Dialog : System.Windows.Forms.Form
      {
            private System.Windows.Forms.Button button1;
            /// <summary>
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.Container components = null;

            public Dialog()
            {
                  //
                  // Required for Windows Form Designer support
                  //
                  InitializeComponent();

                  //
                  // TODO: Add any constructor code after InitializeComponent call
                  //
            }

            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            protected override void Dispose( bool disposing )
            {
                  if( disposing )
                  {
                        if(components != null)
                        {
                              components.Dispose();
                        }
                  }
                  base.Dispose( disposing );
            }

            #region Windows Form Designer generated code
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                  this.button1 = new System.Windows.Forms.Button();
                  this.SuspendLayout();
                  //
                  // button1
                  //
                  this.button1.Location = new System.Drawing.Point(104, 104);
                  this.button1.Name = "button1";
                  this.button1.TabIndex = 0;
                  this.button1.Text = "Show Child";
                  this.button1.Click += new System.EventHandler(this.button1_Click);
                  //
                  // Dialog
                  //
                  this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
                  this.ClientSize = new System.Drawing.Size(292, 273);
                  this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                                                              this.button1});
                  this.Name = "Dialog";
                  this.Text = "Dialog";
                  this.ResumeLayout(false);

            }
            #endregion

            private void button1_Click(object sender, System.EventArgs e)
            {
                  Test1.Child chform = new Test1.Child();

                  Test1.Parent Parent = new Test1.Parent();
                  
                  chform.MdiParent = Parent;

                  chform.Show();
            }
      }
}

////////////
//Child.cs//
////////////

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Test1
{
      /// <summary>
      /// Summary description for Child.
      /// </summary>
      public class Child : System.Windows.Forms.Form
      {
            /// <summary>
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.Container components = null;

            public Child()
            {
                  //
                  // Required for Windows Form Designer support
                  //
                  InitializeComponent();

                  //
                  // TODO: Add any constructor code after InitializeComponent call
                  //
            }

            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            protected override void Dispose( bool disposing )
            {
                  if( disposing )
                  {
                        if(components != null)
                        {
                              components.Dispose();
                        }
                  }
                  base.Dispose( disposing );
            }

            #region Windows Form Designer generated code
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                  this.components = new System.ComponentModel.Container();
                  this.Size = new System.Drawing.Size(300,300);
                  this.Text = "Child";
            }
            #endregion
      }
}
[+][-]02/14/04 11:00 AM, ID: 10362151

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C# Programming Language
Sign Up Now!
Solution Provided By: eternal_21
Participating Experts: 1
Solution Grade: B
 
 
[+][-]02/14/04 12:28 PM, ID: 10362453

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20090824-EE-VQP-74