O'Reilly logo

C# Primer: A Practical Approach by Stanley B. Lippman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.5. The DataGrid Control

To allow the user to select an employee row of the DataGrid, we must provide a button column. A button column can be any of three types: Select; Edit, Up date, Cancel; or Delete. Clicking on a specific button column raises its associated event. For example, the blank push-button in the leftmost DataGrid column is a button column of type Select. When the user clicks on it, a select event is raised. Here is the associated handler:

 public void DataGrid1_SelectedIndexChanged (object sender, EventArgs e) { Label5.Text = "OK. Dialing: " + DataGrid1.SelectedItem.Cells[2].Text + " " + DataGrid1.SelectedItem.Cells[1].Text + " at " + DataGrid1.SelectedItem.Cells[4].Text + " with video "; Label5.Text += CheckBox1.Checked ? "on." ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required