Application #33. Format a DataGrid
This sample shows how to display and format data in a DataGrid control. The data is retrieved from a SQL Server/MSDE database using ADO.NET. The data is loaded into a DataSet object, and the DataGrid control is populated by binding to this DataSet object. The controls on this form use anchoring so that the form resizes intelligently without the developer having to write any code. There are four button controls on the form, which is shown in Figure 4-8. Formatting the appearance of the DataGrid is accomplished using code in each button’s Click event procedure. The buttons are named as follows (ranked in order of increasing control over formatting):
Default: Only default DataGrid formatting is used.
Grid Properties: ...