III.12- Using DataGridView
The DataGridView control provides a customizable table for displaying data. The DataGridView class allows customization of cells, rows, columns, and borders through the use of properties such as DefaultCellStyle, ColumnHeadersDefaultCellStyle, CellBorderStyle, and GridColor. For more information, see Basic Formatting and Styling in the Windows Forms DataGridView Control.
1. Create a ColumnHeader
Source Code: //add
item to datagrid private void
btnAdd_Click(object sender, EventArgs e) { dgrList.Rows.Add(txtID.Text,
txtName.Text, txtPhone.Text); } private void
btnDelete_Click(object sender, EventArgs e) { int i
= dgrList.CurrentCell.RowIndex; dgrList.Rows.RemoveAt(i); } private void
btnClose_Click(object sender, EventArgs e) { this.Close(); } |
0 Comments