اداره کردن رویداد کلیک DataGridViewButtonColumn
مثال زیر یک مثال ساده جهت آموزش کار با DataGridViewButtonColumn یا اداره کردن رویداد کلیک دکمه در دیتاگریدویو می باشد.
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { var datagridview = sender as DataGridView; if (datagridview.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0 ) { string value = datagridview.Rows[e.RowIndex].Cells[0].Value.ToString(); MessageBox.Show(value); } }