How to Open Another Form by Double Clicking on the Cell

Asked

Viewed 56 times

0

I have a table called tournaments that shows the type of game, the name of the tournament and the date.

I want you to do double click in the cell of the type of game open the teams of this type of game.

private void Dgv1_CellMouseDoubleClick(Object sender, DataGridViewCellMouseEventArgs e)
{
    EquipasLOL Tela = new EquipasLOL();
    Tela.Show();
    this.Hide();
}
  • Hello @Jose. Edit your question and enter your code, otherwise it will be difficult to help without having a base!

1 answer

1


Use the event MouseDoubleClick. Check if it is the "Game Type" column using the If. Pass as parameter the Id of the "Game Type" and use it on the screen EquipasLOL.

private void Dgv1_MouseDoubleClick(object sender, MouseEventArgs e)
{
    if(Dgv1.CurrentCell.ColumnIndex == Dgv1.Columns["NomeDaColunaDoTipoDeJogo"].Index)
    {
        EquipasLOL Tela = new EquipasLOL(Dgv1.SelectedRows[0].Cells["ColunaComOIdDoTipoDeJogo"].Value);
        Tela.Show();
        this.Hide();
    }
}
  • Thank you, I’ve solved my problem!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.