(no title) (original) (raw)

Hey, I've just come from using VB.NET to C#.NET, and I've run into a problem. I have a form, and a button. When I click the button, the text on the button changes, and the form gets wider. Then, When you click it again, it goes back to the original width and the text changes back. I did it in VB.NET using Select Case.. but cannot figure it out now.

private void btnFunctions_Click(object sender, System.EventArgs e)
{

int s_width = 536;
int b_width = 712;

string closedFunc = "Funct. -->";
string openFunc = "<-- Funct.";

btnFunctions.Text = closedFunc;

if(btnFunctions.Text == closedFunc)
{
this.Width = b_width;
btnFunctions.Text = openFunc;
}

else if(btnFunctions.Text == openFunc)

{
this.Width = s_width;
btnFunctions.Text = closedFunc;
}
}

Thank you.