Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. is it possible to do this?

is it possible to do this?

Scheduled Pinned Locked Moved C#
question
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tonyonlinux
    wrote on last edited by
    #1

    to make mass data entry easier so i can put my add form over the top of my excel sheet that contains the data i wish to enter. Is there a way to do the following without it minimizing both. I understand the whole parent/child relationship of the forms but i was wondering if i could somehow do this because I have noticed programs like yahoo and so forth allow one form to be minimized while the other is maximized. Anyway here is what I'm trying...

    private void Add_Button_Click(object sender, EventArgs e)
    {
    AddRecord addRecordForm = new AddRecord();
    addRecordForm.Owner = this;
    this.WindowState = FormWindowState.Minimized; //minimize the main form
    addRecordForm.ShowDialog(this); // load up the add form

            this.WindowState = FormWindowState.Normal; //when the add form closes return main form to normal size
            LoadData();
        }
    

    it minimizes but they both minimize instead of only the parent minimizing. i even tried putting in the constructor of the addrecord this.windowstate = formwindowstate.normal; and that had no effect.

    S L D 3 Replies Last reply
    0
    • T tonyonlinux

      to make mass data entry easier so i can put my add form over the top of my excel sheet that contains the data i wish to enter. Is there a way to do the following without it minimizing both. I understand the whole parent/child relationship of the forms but i was wondering if i could somehow do this because I have noticed programs like yahoo and so forth allow one form to be minimized while the other is maximized. Anyway here is what I'm trying...

      private void Add_Button_Click(object sender, EventArgs e)
      {
      AddRecord addRecordForm = new AddRecord();
      addRecordForm.Owner = this;
      this.WindowState = FormWindowState.Minimized; //minimize the main form
      addRecordForm.ShowDialog(this); // load up the add form

              this.WindowState = FormWindowState.Normal; //when the add form closes return main form to normal size
              LoadData();
          }
      

      it minimizes but they both minimize instead of only the parent minimizing. i even tried putting in the constructor of the addrecord this.windowstate = formwindowstate.normal; and that had no effect.

      S Offline
      S Offline
      Saksida Bojan
      wrote on last edited by
      #2

      I have tried compile example into .NET 2.0/3.0/3.5. I am using Windows 7 and didn't encounter your problem. Did you accedently changed windowstato of your AddRecord Form?

      1 Reply Last reply
      0
      • T tonyonlinux

        to make mass data entry easier so i can put my add form over the top of my excel sheet that contains the data i wish to enter. Is there a way to do the following without it minimizing both. I understand the whole parent/child relationship of the forms but i was wondering if i could somehow do this because I have noticed programs like yahoo and so forth allow one form to be minimized while the other is maximized. Anyway here is what I'm trying...

        private void Add_Button_Click(object sender, EventArgs e)
        {
        AddRecord addRecordForm = new AddRecord();
        addRecordForm.Owner = this;
        this.WindowState = FormWindowState.Minimized; //minimize the main form
        addRecordForm.ShowDialog(this); // load up the add form

                this.WindowState = FormWindowState.Normal; //when the add form closes return main form to normal size
                LoadData();
            }
        

        it minimizes but they both minimize instead of only the parent minimizing. i even tried putting in the constructor of the addrecord this.windowstate = formwindowstate.normal; and that had no effect.

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        tonyonlinux wrote:

        addRecordForm.Owner = this; this.WindowState = FormWindowState.Minimized;

        tonyonlinux wrote:

        it minimizes but they both minimize instead of only the parent minimizing

        Does it really? Have you read the documentation[^]. Which is what you always should do when running into a problem. :|

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
        All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.


        1 Reply Last reply
        0
        • T tonyonlinux

          to make mass data entry easier so i can put my add form over the top of my excel sheet that contains the data i wish to enter. Is there a way to do the following without it minimizing both. I understand the whole parent/child relationship of the forms but i was wondering if i could somehow do this because I have noticed programs like yahoo and so forth allow one form to be minimized while the other is maximized. Anyway here is what I'm trying...

          private void Add_Button_Click(object sender, EventArgs e)
          {
          AddRecord addRecordForm = new AddRecord();
          addRecordForm.Owner = this;
          this.WindowState = FormWindowState.Minimized; //minimize the main form
          addRecordForm.ShowDialog(this); // load up the add form

                  this.WindowState = FormWindowState.Normal; //when the add form closes return main form to normal size
                  LoadData();
              }
          

          it minimizes but they both minimize instead of only the parent minimizing. i even tried putting in the constructor of the addrecord this.windowstate = formwindowstate.normal; and that had no effect.

          D Offline
          D Offline
          Dan Mos
          wrote on last edited by
          #4

          here's a working example: In the Main form/container, on the add click do something like this:

                  this.WindowState = FormWindowState.Minimized;
                  this.ShowInTaskbar = false;
          
                  Form2 f = new Form2();
                  f.Owner = this;
                  f.Show();
          
                  //this.WindowState = FormWindowState.Maximized;
          

          and on the LoadDataForm on the form closing event do something like this:

          private void Form2_FormClosing(object sender, FormClosingEventArgs e)
          {
          this.Owner.ShowInTaskbar = true;
          this.Owner.WindowState = FormWindowState.Normal;
          }

          T 2 Replies Last reply
          0
          • D Dan Mos

            here's a working example: In the Main form/container, on the add click do something like this:

                    this.WindowState = FormWindowState.Minimized;
                    this.ShowInTaskbar = false;
            
                    Form2 f = new Form2();
                    f.Owner = this;
                    f.Show();
            
                    //this.WindowState = FormWindowState.Maximized;
            

            and on the LoadDataForm on the form closing event do something like this:

            private void Form2_FormClosing(object sender, FormClosingEventArgs e)
            {
            this.Owner.ShowInTaskbar = true;
            this.Owner.WindowState = FormWindowState.Normal;
            }

            T Offline
            T Offline
            tonyonlinux
            wrote on last edited by
            #5

            thanks that worked.

            1 Reply Last reply
            0
            • D Dan Mos

              here's a working example: In the Main form/container, on the add click do something like this:

                      this.WindowState = FormWindowState.Minimized;
                      this.ShowInTaskbar = false;
              
                      Form2 f = new Form2();
                      f.Owner = this;
                      f.Show();
              
                      //this.WindowState = FormWindowState.Maximized;
              

              and on the LoadDataForm on the form closing event do something like this:

              private void Form2_FormClosing(object sender, FormClosingEventArgs e)
              {
              this.Owner.ShowInTaskbar = true;
              this.Owner.WindowState = FormWindowState.Normal;
              }

              T Offline
              T Offline
              tonyonlinux
              wrote on last edited by
              #6

              i was wondering something since the documentation states if the parent minimizes so does the child. (this was really my original question) because i had read this in the documentation BEFORE asking. is it possible to make the add form an owner of itself? i tried and it said I can't. Basically what I'm trying to achieve all of the parent/child stuff asside is the following. I guess what i want is the form to not be a child but simply another parent (per say). I'm trying to make it where when i click on the addbutton up pops the addrecord form. and the main form minimizes. as documented and seen and so forth both will minimize. sure i can go down there and click on the thing to open it back up since the mainform is hidden until close(that part i like) but i want the child form return to normal state. is there some kinda method that you can use on the form like you do controls as form1.visible = false or hidden = true or something like that then change that on the form2 closeevent ?

              D 1 Reply Last reply
              0
              • T tonyonlinux

                i was wondering something since the documentation states if the parent minimizes so does the child. (this was really my original question) because i had read this in the documentation BEFORE asking. is it possible to make the add form an owner of itself? i tried and it said I can't. Basically what I'm trying to achieve all of the parent/child stuff asside is the following. I guess what i want is the form to not be a child but simply another parent (per say). I'm trying to make it where when i click on the addbutton up pops the addrecord form. and the main form minimizes. as documented and seen and so forth both will minimize. sure i can go down there and click on the thing to open it back up since the mainform is hidden until close(that part i like) but i want the child form return to normal state. is there some kinda method that you can use on the form like you do controls as form1.visible = false or hidden = true or something like that then change that on the form2 closeevent ?

                D Offline
                D Offline
                Dan Mos
                wrote on last edited by
                #7

                sure you can trick the owner. But a better solution is to not own the dataform. Something like:

                private btn1Click(object sender, EventArgs e){
                this.Hide();
                DataForm df = new DataForm();
                df.ShowDialog();

                //now show back your main form
                this.Show();
                }

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups