HUsing ADO.NET 2.0 with Microsoft Access Databases - Cengage ...
HUsing ADO.NET 2.0 with Microsoft Access Databases - Cengage ...
HUsing ADO.NET 2.0 with Microsoft Access Databases - Cengage ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
10 Appendix H Using <strong>ADO</strong>.<strong>NET</strong> <strong>2.0</strong> <strong>with</strong> <strong>Microsoft</strong> <strong>Access</strong> <strong>Databases</strong><br />
Figure H.13 shows the result of dragging the tblEmploy table object to the<br />
MainForm, using the default control type for a table, and then sizing the control.<br />
In this case, the DataGridView control was sized by first setting its<br />
AutoSizeColumnsMode property to Fill. The Fill setting automatically adjusts<br />
the column widths so that all of the columns exactly fill the display area of the<br />
control. The control’s right border was then dragged to the desired width.<br />
BindingNavigator control<br />
DataGridView control<br />
AutoSizeColumnsMode property<br />
TableAdapter object<br />
BindingSource object<br />
DataSet object<br />
BindingNavigator object<br />
FIGURE H.13<br />
Result of dragging the tblEmploy table object to the form<br />
in the Morgan Industries application<br />
Besides adding a DataGridView control to the form, the computer also<br />
adds a BindingNavigator control. When an application is running, the<br />
BindingNavigator control allows you to move from one record to the next<br />
in the dataset. It also allows you to add and delete a record, as well as save any<br />
changes made to the dataset.<br />
In addition, the computer places four objects in the component tray: a<br />
DataSet, a BindingSource, a TableAdapter, and a BindingNavigator. As you<br />
learned in Chapter 2, the component tray stores objects that do not appear in<br />
the user interface when an application is running. An exception to this is the<br />
BindingNavigator object, which appears as the BindingNavigator control during<br />
both design time and run time. Figure H.14 illustrates the relationships among<br />
the database, the objects in the component tray, and the controls on the form.<br />
Appendix H C5779 39147 Page 10 07/10/06--JHR