MS-FlexGrid Sample Applications


The following sample applications are included when you purchase the Visual Basic 6 Tutorial Download Package or the Visual Basic 6 "Extra" Sample Applications from The VB Programmer.


1. Basic FlexGrid Database Application

This is a sample program that uses the FlexGrid to work with data from a database table.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 FlexGrid, how to include a picture in a FlexGrid cell, how to control the selection highlighting, how set the background color of individual rows (note that this example uses alternating green and white rows), and how to sort the grid on a particular column (note that in the screen shot, the data is sorted on zip code).



2. FlexGrid Demo to Vary Row Height Based on Content

This sample application demonstrates a technique to vary the height of a FlexGrid 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 FlexGrid row adjusts accordingly.



3. FlexGrid Demo to Simulate Checkboxes

Although the FlexGrid does not have a built-in "checkbox" property, you can simulate this functionality using two graphics (a checked box and an unchecked box). This demo program shows how to do it. A screen shot is shown below.