I have a problem in firing DataGridView SelectionChanged using code, i'm working on Windows forms unsing C# on Visual Studio 2013.
I use this solution :
private void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
/* Code here ... */
}
and fire it using a button click like this :
private void button1_Click(object sender, EventArgs e)
{
...
dataGridView1_SelectionChanged(sender,e);
...
}
Is this the right way to do this ?
very simple , the following will fire dataGridView1_SelectionChanged
event handler
private void button1_Click(object sender, EventArgs e)
{
dataGridView1.Rows['row_index'].Selected = true;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.