I always get this problem when I link forms in C#.
Here’s the code of the first form:
using ybird;
public partial class form1 : Form
{
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
try
{
register form = new register();
register.Show();
}
catch (Exception w)
{
MessageBox.Show(w.Message, Application.ProductName);
}
}
}
And here’s the code for the Register.cs:
namespace ybird
{
public partial class register : Form
{
}
}
what did I do wrong?
This will not work, as
Showis an instance method, not astaticmathod:You probably meant:
Note:
Your naming is non standard – types in .NET are normally in PascalCase – to be consistent, your should name the class
Register. Additionally, using the variableformis not very descriptive –registerFormwould be better.