Thread: C# Assignment

  1. #1
    Registered User BraneMxm's Avatar
    Join Date
    Apr 2007
    Location
    Croatia
    Posts
    20

    C# Assignment

    Hi to all i have an assignment that i dont aunderstand at all.

    I know the OOD paradigm but i am not sure what this assingment wants me to do.

    I should create an C# win ap. When opened 3 forms should open(doesnt matter where and how), form1 should have a button and an event that raises when i click the button. The second form should be "prepaid" on the on that event that should have the following functionality: when that event happens form2 should set the focus on itself and take over the ownershp over form3 and raise an event on which form3 is prepaid. that event should set the focus on itself and take over the ownership over form1.

    And i should explain how the ownerships affects the appereance of the windows.

    Puh, I really cant look through all of this. Please help me

    Thanks

    EDIT

    I have made some code but i am not sure if this is what is requested. And i dont know whow to call ev2?
    Code:
    namespace vjezba4dio3
    {
        public partial class Form1 : Form
        {
            private Form2 frm2 = new Form2();
            private Form3 frm3 = new Form3();
            
            public Form1()
            {
                InitializeComponent();
                EventHandler ev = new EventHandler(this.button1_Click);
                EventHandler ev2 = new EventHandler(this.fr3);
                frm2.Show();
                frm3.Show();
                
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                frm2.BringToFront();
                frm3.Owner = frm2;
                
            }
            void fr3(object sender, EventArgs e)
            {
                frm3.BringToFront();
                this.Owner = frm3;
            }
           
        }
    }
    Last edited by BraneMxm; 06-03-2007 at 05:16 AM.

  2. #2
    Registered User BraneMxm's Avatar
    Join Date
    Apr 2007
    Location
    Croatia
    Posts
    20

    Solution

    Code:
    namespace vjezba4dio3
    {
        public partial class Form1 : Form
        {
            private Form2 frm2 = new Form2();
            private Form3 frm3 = new Form3();
            public EventHandler ev2 ;
    
            public Form1()
            {
                InitializeComponent();
                EventHandler ev = new EventHandler(this.button1_Click);
                ev2 = new EventHandler(this.fr3);
    
                frm2.Show();
                frm3.Show();
    
            }
    
            
            void fr3(object sender, EventArgs e)
            {
                frm3.Focus();
                this.Owner = frm3;
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                frm2.Focus();
                frm3.Owner = frm2;
                ev2.Invoke(sender, e);
               
              
            }
    
           
    
        }
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Menu
    By Krush in forum C Programming
    Replies: 17
    Last Post: 09-01-2009, 02:34 AM
  2. Assignment Operator, Memory and Scope
    By SevenThunders in forum C++ Programming
    Replies: 47
    Last Post: 03-31-2008, 06:22 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Help with a pretty big C++ assignment
    By wakestudent988 in forum C++ Programming
    Replies: 1
    Last Post: 10-30-2006, 09:46 PM
  5. Replies: 1
    Last Post: 10-27-2006, 01:21 PM