Hey guys im making a basic notepad right now with beginner knowledge and right now i am using the file menu on my form to open an "About" form now i have it opening up and displaying properly using this code
but the problem i am having is with my code to close the form right now i am trying this code for the close button on my second form.Code:public void aboutNotepadToolStripMenuItem_Click(object sender, EventArgs e) { Form2 Form2 = new Form2(); Form2.Show(); }
this doesn't give me any errors. form2 simply does not close. i tried with just Form2.Close(); for my close button but it gives me an error before running.Code:private void button1_Click(object sender, EventArgs e) { Form2 Form2 = new Form2(); Form2.Close(); }
i figure it has something to do with me creating a new instance of form2 right before i close. i just cant figure out any other way to put the code so i don't get an error.
Any Help would be appreciated, i think this is a pretty easy one anyway.
All you have to do is change
toCode:Form2.Close();
And it will close the form.Code:this.Close();![]()
Knowledge: Intermediate C#, Beginner AS3, HTML, CSS, Binary, Hex, Octal.
Science is only an educated theory, which we cannot disprove.
:O <3 thx lol was driving me crazy.
Hehe no prob.![]()
Knowledge: Intermediate C#, Beginner AS3, HTML, CSS, Binary, Hex, Octal.
Science is only an educated theory, which we cannot disprove.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks