• Log in or sign up for an account here: https://www.sythe.org/login

How do i open a new form when i click a button?

hampe-92

Forum Addict
Joined
Jul 10, 2008
Sythe Gold
0
Messages
328
How do i open a new form when i click a button?
I need some help here... let's say I start out with a form, called "Form1"
when I have edited that so it looks just like I want it, then I want to make it open a form called "Form2" when I click a button... how can I possibly do that??
thx in advance!:)
 
How do i open a new form when i click a button?
You need to create a new form and call its Show method.

Code:
private void button_Click(object sender, EventArgs e)
{
    Form form = new Form();
    form.Show();
}
 
How do i open a new form when i click a button?
You need to create a new form and call its Show method.

Code:
private void button_Click(object sender, EventArgs e)
{
    Form form = new Form();
    form.Show();
}

yay it works :D tyvm!:)

EDIT: hmm :/ i wrote:
Code:
private void button_Click(object sender, EventArgs e)
{
    Form Form2 = new Form();
    Form2.Show();
}
and that opens up a new form, but not my form, "Form2", that i have made... it just opens a blank new form :confused:
 
How do i open a new form when i click a button?
Code:
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(New FormName());
this.hide();
 
How do i open a new form when i click a button?
Code:
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(New FormName());
this.hide();
thx but it works just fine that way Flaming said.. ;)
and beside, i don't want form1 to be closed when i open form2 :p but thx anyway, it might come in handy l8er some time:)
 
How do i open a new form when i click a button?
thx but it works just fine that way Flaming said.. ;)
and beside, i don't want form1 to be closed when i open form2 :p but thx anyway, it might come in handy l8er some time:)
Well incase you wanted to close form1 you could use that method also.
 
How do i open a new form when i click a button?
what u mean? your or his method?
 
Runescape Gamblingrunescape gambling
Back
Top