Opening a form inside another
-
I am developing an application where I am seeking the look and feel of Microsoft Outlook. I have created some forms for my different objects (contracts, suppliers etc.). I have created ContractListForm, ContractForm, SupplierListForm and SupplierForm among others. Now, in my main form, I have a toolbar to the left and when the user clicks one of the buttons, I want to open up the correct *ListForm to the right (not in a new window). Is this possible? If not, how should I design this? I would like to be able to do just like in Outlook, where the user can chose to open the Inbox for instance either to the right, or in a new window. /Ricky
-
I am developing an application where I am seeking the look and feel of Microsoft Outlook. I have created some forms for my different objects (contracts, suppliers etc.). I have created ContractListForm, ContractForm, SupplierListForm and SupplierForm among others. Now, in my main form, I have a toolbar to the left and when the user clicks one of the buttons, I want to open up the correct *ListForm to the right (not in a new window). Is this possible? If not, how should I design this? I would like to be able to do just like in Outlook, where the user can chose to open the Inbox for instance either to the right, or in a new window. /Ricky
What I did one time when I was trying to do the same thing was put a panel control where you want the form to go. The panel control, if I remember correctly, is able to "host" a form so you just create an instance of the form and add it to the panels controls.
-
I am developing an application where I am seeking the look and feel of Microsoft Outlook. I have created some forms for my different objects (contracts, suppliers etc.). I have created ContractListForm, ContractForm, SupplierListForm and SupplierForm among others. Now, in my main form, I have a toolbar to the left and when the user clicks one of the buttons, I want to open up the correct *ListForm to the right (not in a new window). Is this possible? If not, how should I design this? I would like to be able to do just like in Outlook, where the user can chose to open the Inbox for instance either to the right, or in a new window. /Ricky
You can somehow set ID numbers to the buttons on your toolbar and then catch every event from this button or something like this private void button1_click (la la la ..) { ContractListForm frm1 = new ContractListForm(); this.Hide(); frm1.Show(); } "I have not failed. I've just found 10,000 ways that won't work." - Thomas Alva Edison (1847-1931)
-
What I did one time when I was trying to do the same thing was put a panel control where you want the form to go. The panel control, if I remember correctly, is able to "host" a form so you just create an instance of the form and add it to the panels controls.
I have already tried that but when i Run: myPanel.Controls.Add(myForm); ...I get an error message something like this: "You can not add a top-level control to a control". (I should have written that in my first post.) So, do you know if it still is possible any other way? /Ricky
-
I have already tried that but when i Run: myPanel.Controls.Add(myForm); ...I get an error message something like this: "You can not add a top-level control to a control". (I should have written that in my first post.) So, do you know if it still is possible any other way? /Ricky
What I did was this, and it works for me: In the constructor code for the form add: this.TopLevel = false; In your main form use this: frmAddNew add = new frmAddNew( ); add.Parent = panelWorkArea; panelWorkArea.Controls.Add( add ); add.Visible = true; Let me know if that works for you.
-
I am developing an application where I am seeking the look and feel of Microsoft Outlook. I have created some forms for my different objects (contracts, suppliers etc.). I have created ContractListForm, ContractForm, SupplierListForm and SupplierForm among others. Now, in my main form, I have a toolbar to the left and when the user clicks one of the buttons, I want to open up the correct *ListForm to the right (not in a new window). Is this possible? If not, how should I design this? I would like to be able to do just like in Outlook, where the user can chose to open the Inbox for instance either to the right, or in a new window. /Ricky
One other approach would be to derive all your *ListForms from UserControl instead of Form. You can still use the forms designer with a UserControl. I don't think you will lose much, if any, functionality that you need, but you may have more flexibility for reusing the *ListForms and for hosting them in any type of control or form. I've also been wondering about the best approach for something like this, so I would like to pose a general question to the group. To create the type of "Outlook" UI Ricky asks about, is it better to use Forms or Controls (such as UserControl)? Which has more flexibility? Which is easier for RAD UI development? Which has more support and is more widely used? Which is easier for integrating menus, toolbars, etc.? In my case, I have two choices. I could use either a tabbed MDI host (like in VS.NET) with multiple forms, or I could use various host controls (including tab controls, etc.) to display my own UserControl-derived objects. Any comments are appreciated. Dave
-
What I did was this, and it works for me: In the constructor code for the form add: this.TopLevel = false; In your main form use this: frmAddNew add = new frmAddNew( ); add.Parent = panelWorkArea; panelWorkArea.Controls.Add( add ); add.Visible = true; Let me know if that works for you.
Thank you! That works just fine. Next, I will try to get rid of the form border. I quickly found the ways to remove the system, minimize, maximize and close buttons. I docked the form to the panel so when the panel (inside it's form) resizes, the subform follows. Perfect... but, the user still sees the window border and caption and can manually resize the form. I suppose it's very easily removed but I simply have not found the command yet. My knowledge in Windows Forms seems quite rudamentary yet. /Ricky
-
Thank you! That works just fine. Next, I will try to get rid of the form border. I quickly found the ways to remove the system, minimize, maximize and close buttons. I docked the form to the panel so when the panel (inside it's form) resizes, the subform follows. Perfect... but, the user still sees the window border and caption and can manually resize the form. I suppose it's very easily removed but I simply have not found the command yet. My knowledge in Windows Forms seems quite rudamentary yet. /Ricky