Showing a different form in c#?

2634 views c#
5

I've looked at a few different threads and tried to find the proper answer, none have worked. I am trying to hide the current Form. I know how to do that, but when I do ProjectName.Form2.Visible() it gives me an error and says to just use Visible(), unfortunately, that makes Form1 visible.

answered question

Hey, welcome to SO. It would be a good idea to add some code that can help everyone here understand the issue and try to help you. You can use this guideline for reference: stackoverflow.com/help/mcve

1 Answer

8

You would need to create a new instance of the form and call .Visible() on that instance.

var newForm = new ProjectName.Form2();
newForm.Visible();

When you call ProjectName.Form2.Visible() it looks for a static method on the class called Visible which does not exist.

posted this

Have an answer?

JD

Please login first before posting an answer.