Windows Form
-
How to create parent form and child form usin c#. I want to create a parent form and two or three radio buttons should be on parent form, when user click on 1st radio button then a child form should be opened related to 1st radio button and another radio button vice-versa....... Please reply Quickly.........
DSPNEO
-
How to create parent form and child form usin c#. I want to create a parent form and two or three radio buttons should be on parent form, when user click on 1st radio button then a child form should be opened related to 1st radio button and another radio button vice-versa....... Please reply Quickly.........
DSPNEO
Put a button on there, doubleclick;
public void Form1_Button1_Click(object sender, EventArgs e)
{
using(var myForm = new FormChildWithCoolName())
{
myForm.ShowDialog(this);
}
}DSPNEOqqq wrote:
Please reply Quickly.........
Quickly, quickly Zathras..
Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
-
Put a button on there, doubleclick;
public void Form1_Button1_Click(object sender, EventArgs e)
{
using(var myForm = new FormChildWithCoolName())
{
myForm.ShowDialog(this);
}
}DSPNEOqqq wrote:
Please reply Quickly.........
Quickly, quickly Zathras..
Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
Eddy Vluggen wrote:
Quickly, quickly Zathras..
Babylon 5?
Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
-
Eddy Vluggen wrote:
Quickly, quickly Zathras..
Babylon 5?
Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
-
How to create parent form and child form usin c#. I want to create a parent form and two or three radio buttons should be on parent form, when user click on 1st radio button then a child form should be opened related to 1st radio button and another radio button vice-versa....... Please reply Quickly.........
DSPNEO
Create your forms, set the parent form as Owner of the child. May be MDI forms can helps too. That's all.
Christian Amado MCITP | MCTS | MOS | MTA Olimpia ☆ ★★★ Please mark as answer, if it helps.
-
How to create parent form and child form usin c#. I want to create a parent form and two or three radio buttons should be on parent form, when user click on 1st radio button then a child form should be opened related to 1st radio button and another radio button vice-versa....... Please reply Quickly.........
DSPNEO
Hi, First, I believe that Child Forms should never be used, that they lead to awkward user-interfaces, and the old MDI-architecture, which supported MDIChildForms with "special features," deserves the status of a "dinosaur" skeleton: to be looked at, but not re-animated :) I think you can get better responses to this scenario if you describe what the function of your proposed use of "Child Forms" are, in relation to their "Parent" Form. Is it possible a Dialog can fit your needs here ? Consider that you create a "Child Form" with code like this in response to some event:
Form form2 = new Form(); form2.TopLevel = false; // mandatory for Child Forms form2.ShowInTaskbar = false; form2.Parent = this; form2.Name = "form2"; form2.Text = "form2"; form2.Size = new Size(300, 200); form2.Show(); form2.BringToFront();
You now have a Form that is in front of your MainForm, and that, depending on FormBorderStyle, can be moved around so parts of it are invisible, as they extend beyond the DisplayRectangle of the MainForm. Depending on its z-order within the Form ... that is if some other control on the Form has been brought-to-the-front: it could appear "behind" other Controls on the Form. Consider that you create a Form which is not a ChildForm: like this:
Form form2 = new Form(); form2.ShowInTaskbar = false; form2.Name = "form2"; form2.Text = "form2"; form2.Size = new Size(300, 200); form2.Show(); form2.BringToFront();
Now you have a Form you can move anywhere on the screen, depending on the setting of FormBorderStyle, and it will always be visible ... unless you activate the MainForm and bring it to the front, and the MainForm covers part of the second Form. If you wanted this new Form to always remain on top, no matter whether the MainForm was activated, or not: just set the new Form's TopMost property to 'true, while making the sure the MainForm's TopMost property is set to 'false. Another area to investigate, if you are concerned with your new Form always appearing on top, is the use of 'ShowModal(), in contrast to 'Show(). Keep in mind that: if your WinForms project opens in the rather standard way by creating an instance of the MainForm in the Program.cs class: that closing the MainForm will always automatically close any secondary Forms created. In eith
-
Hi, First, I believe that Child Forms should never be used, that they lead to awkward user-interfaces, and the old MDI-architecture, which supported MDIChildForms with "special features," deserves the status of a "dinosaur" skeleton: to be looked at, but not re-animated :) I think you can get better responses to this scenario if you describe what the function of your proposed use of "Child Forms" are, in relation to their "Parent" Form. Is it possible a Dialog can fit your needs here ? Consider that you create a "Child Form" with code like this in response to some event:
Form form2 = new Form(); form2.TopLevel = false; // mandatory for Child Forms form2.ShowInTaskbar = false; form2.Parent = this; form2.Name = "form2"; form2.Text = "form2"; form2.Size = new Size(300, 200); form2.Show(); form2.BringToFront();
You now have a Form that is in front of your MainForm, and that, depending on FormBorderStyle, can be moved around so parts of it are invisible, as they extend beyond the DisplayRectangle of the MainForm. Depending on its z-order within the Form ... that is if some other control on the Form has been brought-to-the-front: it could appear "behind" other Controls on the Form. Consider that you create a Form which is not a ChildForm: like this:
Form form2 = new Form(); form2.ShowInTaskbar = false; form2.Name = "form2"; form2.Text = "form2"; form2.Size = new Size(300, 200); form2.Show(); form2.BringToFront();
Now you have a Form you can move anywhere on the screen, depending on the setting of FormBorderStyle, and it will always be visible ... unless you activate the MainForm and bring it to the front, and the MainForm covers part of the second Form. If you wanted this new Form to always remain on top, no matter whether the MainForm was activated, or not: just set the new Form's TopMost property to 'true, while making the sure the MainForm's TopMost property is set to 'false. Another area to investigate, if you are concerned with your new Form always appearing on top, is the use of 'ShowModal(), in contrast to 'Show(). Keep in mind that: if your WinForms project opens in the rather standard way by creating an instance of the MainForm in the Program.cs class: that closing the MainForm will always automatically close any secondary Forms created. In eith
BillWoodruff wrote:
First, I believe that Child Forms should never be used, that they lead to awkward user-interfaces, and the old MDI-architecture
..I'd like to see a version of Visual Studio with an SDI-interface. MDI isn't dead, it's merely abused a lot. We'll say the same thing about that Ribbon on a few years :)
BillWoodruff wrote:
I think you can get better responses to this scenario if you describe what the function of your proposed use of "Child Forms" are, in relation to their "Parent" Form.
Good point; when an apparant beginner talks about child-forms, I usually assume (I know, we should check, not assume) that they need to display a dialog, and that they forgot to specify the owner of the form (often confused with the parent). +5 for giving a very elaborate answer that does not only benefit the TS.
Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]