0

I have two forms, the main form and a form named FrmSteg. I added a button on the main form and entered the code below in the click event of the button.But i got an error "Only assignment, call, increment, decrement, and new object expressions can be used as a statement"

private void btnsteg_Click(object sender, EventArgs e)
{
    FrmSteg newForm = new FrmSteg();
    newForm.Show;
    this.Hide; 
}

3 Answers 3

5

Try this:

newForm.Show();
this.Hide();
Sign up to request clarification or add additional context in comments.

Comments

2

You forgot the () behind the method call:

newForm.Show();
this.Hide();

Comments

1

If the new form is supposed to be used as kind of a dialog, use ShowDialogue(newForm); This will "lock" your main form until the new form has been closed.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.