I have a gridview with 2 column, one is a DataGridViewCheckBoxColumn named “choose” , the other is an ordinary DataGridViewTextBoxColumn named “ID”… I want to change the text of a textbox immediately when the checked of chechkbox column changed …. but i don’t know which event should i use ….
void SetTextBox()
{
TextBox1.Text="";
for (int i = 0; i < MyGrid.Rows.Count; i++)
if (Convert.ToBoolean(MyGrid.Rows[i].Cells["choose"].Value) == true)
{
TextBox1.Text += MyGrid.Rows[i].Cells["ID"].Value.ToString()+",";
}
}
private void !!!!which Event?!!!!(object sender, EventArgs e)
{
SetTextBox();
}
There’s actually two events you need to deal with. Here’s an example adapted from the code I’m working on right now.
The first event tells it “Automatically commit this when it changes”, the second event is “When the value is committed, do something”.