Search code examples
c#functionbuttongroupbox

The function of buttons is removed when moving to group box?


At the beginning, I had 5 buttons in a panel and they worked perfectly. For example,

private void btnFlipX_Click(object sender, EventArgs e)
{
    imgBox.Image.RotateFlip(RotateFlipType.Rotate180FlipX);
    imgBox.Refresh();
}

However, when I moved them to groupbox, they did not work anything. I clicked on a button in groupbox and there was anything in there (there is no code in them). For example,

private void btnFlipX_Click_1(object sender, EventArgs e)
{

}

Anyone can give me the reason of this problem?


Solution

  • It looks like VS just added a new event method for your automatically and named it btnFlipX_Click_1 instead of btnFlipX_Click; Are you sure you are assigning the right event (Where the += is)