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):

  1. Default: Only default DataGrid formatting is used.

  2. Grid Properties: ...

Get 101 Microsoft® Visual Basic® .NET Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.