Windows Forms: Data Binding with Navigation
This example shows how to create a typical data bound form. The information
is displayed in a series of text
boxes. As the user scrolls through the records, the text in the text boxes
changes.
Featured Highlights
This sample shows how to data
bind individual fields to controls. The sample
also illustrates scrolling through the records using the typical first,
previous,
next, and last controls. In addition, the current record number, and total
number of records, are displayed in a label.
For some fields (Boolean values, and Currency), custom formatting is
accomplished
using the Format event of the Binding class.
Finally, the user can scroll through the records using the cursor keys. Right
and left move to the next and previous records respectively, and home and end
move to the first and last records. Page down/up skip forwards and backwards
10 records at a time.
The information is retrieved into a Typed Dataset. This object offers a number
of
advantages over generic DataSets, which include simpler code, and less
opportunity
for errors. For more information, see "Introduction to Datasets" in the MSDN
documentation.
Requirements
Requires the release version of Visual Studio .NET Professional (or greater)
and access to the Northwind database residing in SQL Server or the Microsoft
Data Engine (MSDE). To install MSDE, do the following:
1. Open the Start menu, then click Programs, the click Microsoft .NET Framework
SDK, and then click Samples and Quickstart Tutorials.
2. Click "Step 1: Install the .NET Framework Samples Database".
3. Open a command window, and CD to <FrameworkSDK>\Samples\Setup
This is typically :
C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Samples\Setup
4. Type: osql -E -S (local)\NetSDK -i InstNwnd.sql
Running the Sample
Simply Press F5.
See also