How to Bind Data to the Windows Forms DataGridView Control
Submitted by admin on Saturday, June 27, 2009 - 23:05.
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. (Source: MSDN)
The DataGridView control is a new control that replaces the DataGrid control. The DataGridView control provides numerous basic and advanced features that are missing in the DataGrid control. Additionally, the architecture of the DataGridView control makes it much easier to extend and customize than the DataGrid control. (Source: MSDN)
If you are new to DataGridView control you will encounter minor problem on how to connect its datasource to the database. I am even confused with the sample source code given by Microsoft. But in this tutorial you will learn how to bind data to the Windows Forms DataGridView Control.
With a few modifications on the code from our previous example you will learn exactly how to bind data to the DataGridView control.
Microsoft Access and Microsoft SQL Server sample are being provided.
Previous: ListView Control
Next: Windows Forms - CheckBox Control