1
In my program there is a button to mark and the same button to uncheck a checkbox.
Example: If I click once, it marks the check box, if I click again on the button it unchecks the check box. However, if you click again no longer mark the checkbox, after the second click the button loses the action.
Follows my code:
public frmLaudosPS()
{
InitializeComponent();
this.btn_seleciona.Click += this.marcar;
}
private void marcar(object sender, EventArgs e)
{
DataTable table = (DataTable)dgw_laudos.DataSource;
foreach (DataRow row in table.Rows)
row["SELECIONAR"] = true;
this.btn_seleciona.Click -= this.marcar;
this.btn_seleciona.Click += this.desmarcar;
}
private void desmarcar(object sender, EventArgs e)
{
DataTable table = (DataTable)dgw_laudos.DataSource;
foreach (DataRow row in table.Rows)
row["SELECIONAR"] = false;
}
The code of
desmarcar
. Without it it is impossible to help without being at the base of the kick.– Jéf Bueno
Sorry I forgot the rest of the code, I already put the rest of the code. Vlw.
– Junior Guerreiro