Click here to Skip to main content
16,021,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When i hav creted one form on it's button click second form is displayed. Please give me solution to close the first from. I hav tried the same in VB .There is property ME.CLOSE in VB. Is there anything like that in C#?

Thanks.
Posted
Updated 15-Jan-10 3:22am
v2

In C# the "this" keyword is similar to "me" VB
 
Share this answer
 
In C# use
this

consider btnClose is button on first form
private void btnClose_Click(object sender, EventArgs e)
{

  Form frmSecond = new frmSecond();

  frmSecond.Show();

  frmSecond.Activate();

  this.Close();

}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900