
Visual Basic .NET Code Sample: DataGrid Formatting
Brief Description
This sample shows how you can retrieve data from the database, display the data in a DataGrid, and how to format the appearance of the DataGrid.
On This Page
Quick Details
| File Name: | DataGridFormatting.exe |
| Version: | 1.0 |
| Date Published: | 7/29/2002 |
| Language: | English |
| Download Size: | 175 KB |
| Estimated Download Time: | 1 min 56K |
Overview
This sample shows how you can retrieve data from the database, display the data in a DataGrid, and how to format the appearance of the DataGrid.
Top of page
System Requirements
- Supported Operating Systems: Windows 2000; Windows NT; Windows XP
- Microsoft Visual Studio. NET Professional
- Access to the Northwind database residing in SQL Server or the Microsoft Data Engine (MSDE)
Top of page
Instructions
- Select "Run this Program from its Current Location" to start the download immediately.
- Select "Save this Program to Disk" to copy the download to your machine for installation at a later time.
To install MSDE, do the following:
- Open the Start menu, then click Programs, then click
Microsoft .NET Framework SDK, and then click Samples and Quickstart Tutorials.
- Click "Step 1: Install the .NET Framework Samples Database".
- Open a command window, and CD to \Samples\Setup. This is typically: C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Samples\Setup
- Type: osql -E -S (local)\NetSDK -i InstNwnd.sql
Top of page
Additional Information
Featured Highlights
ADO.NET is used to retrieve the information from SQL Server. The data is loaded into a DataSet, and the DataGrid is populated by binding to the DataSet.
The controls on this form utilize anchoring so that the form resizes intelligently without the developer having to write any code.
Formatting the DataGrid's appearance is accomplished using code in four button click event handlers. The formatting code implemented in each event handler increases in complexity and granularity. The buttons are named as follows (ranked in order of increasing control over formatting):
- Default: Only default DataGrid formatting is used.
- Grid Properties: Only DataGrid formatting properties are used.
- Table Style: A DataGridTableStyle object is used to format the DataGrid.
- Column Styles: DataGridColumnStyle objects are added to the DataGridTableStyle object.
Top of page
What Others Are Downloading
Top of page