private void tool_eliminar_Click(object sender, EventArgs e) { var res = MessageBox.Show("¿Esta seguro de eliminar?", "Eliminar", MessageBoxButtons.YesNo); if (res.ToString().Equals("Yes")) { int indiceFila = DtgProveedores.CurrentCell.RowIndex; string id = DtgProveedores[0, indiceFila].Value.ToString(); try { Opln.eliminar(int.Parse(id)); MessageBox.Show("Se han eliminado los datos!"); mostrarProductos(); } catch (Exception er) { MessageBox.Show(er.Message); } } }