DataGridView Sample Applications
The following sample applications are included when you purchase the VB 2010 Tutorial Download Package or the VB 2010 "Extra" Sample Applications from The VB Programmer.
1. Basic DataGridView Application
This is a sample program that uses the DataGridView to work with data from a database table. (The data is populated using code; i.e. this application uses the DataGridView in “unbound” mode.) This sample application is a variation of the "More ADO" topic (which used a ListView to display the customer data). By looking at the coding for this application, you will see how to set up the rows and columns of the DataGridView, how to include a picture in a DataGridView cell, how to control the selection highlighting, and how set the background color of individual rows (note that this example uses alternating green and white rows). The DataGridView provides automatic sorting.
2. DataGridView Demo with Variable-Hieght Rows and Checkbox Column
This sample application demonstrates the use of the word wrap feature to vary the height of a DataGridView row based on the content of a field that could contain a varying amount of text. In this sample application, data from the Employees table of the NorthWind database is used. The length of the Notes field varies from record to record, and the height of the DataGridView row adjusts accordingly. Also, this application illustrates the use of a checkbox column.