form.show(); in c#
-
Tuesday, November 13, 2007 7:12 AM
Hi I'm new to c# -- trying to switch to a different form in a mobile app.
I start with:
using System;
using
System.Collections.Generic;using
System.ComponentModel;using
System.Data;using
System.Drawing;using
System.Text;using
System.Windows.Forms;namespace
SwitchFormTest{
public partial class Form1 : Form{
public Form1(){
InitializeComponent();
}
private void menuItem2_Click(object sender, EventArgs e){
Form2.show();}
}
}
but when I try to run debugger it says "SwitchFormTest.Form2 does not contain a definition for show"
VS offer is generate a method stub on Form2 and throws in the following to the form2 code:
internal
static void show(){
throw new Exception("The method or operation is not implemented.");Then when I run the debugger the app of course throws an exception there.
Any advice?
THanks
All Replies
-
Tuesday, November 13, 2007 8:02 AM
Hi,
did you try:
Form2 form2 = new Form2();
form2.show();
Cheers, Peter
-
Tuesday, November 13, 2007 3:51 PM
Thanks so much!!
-
Friday, April 11, 2008 2:38 PM
i need help..
i am using form.show(); to jump to another form named menu.. i ve used the code u suggested.. but its not working..
using
System;using
System.Collections.Generic;using
System.ComponentModel;using
System.Data;using
System.Drawing;using
System.Text;using
System.Windows.Forms;namespace
DeviceApplication2{
public partial class form1 : Form{
public form1(){
InitializeComponent();
}
private void login_Click(object sender, EventArgs e){
menu m = new menu();m.show();
}
}
}
- Proposed As Answer by venuchary Thursday, December 23, 2010 5:48 AM
-
Monday, September 07, 2009 9:55 AMyour show() method does not exits for sure. because it is case sensitive. so it should be m.Show(). hope this helps
-
Thursday, December 23, 2010 5:38 AM
hello
i was used previous code but i get error like this "Error 1 The type or namespace name 'Form2'
could not be found (are you missing a using directive or an assembly reference? "
i was created two window form then i still not get it.
-
Thursday, January 20, 2011 1:27 PM
You need to create an object of that particular form, you want to open.
Like Form name is then you will code it like
CustomerDetails myform=new CustomerDetails();
myform.Show();CustomerDetails() is the constructer of CustomerDetails. I hope you have enough knowledge of Constructors.
:)Vote and mark so that you get marked and voted
- Proposed As Answer by Faisal Hayat Thursday, January 20, 2011 1:27 PM
-
Saturday, November 03, 2012 12:21 PMThanks Faisal it worked.

