474 Part IV Database and Web Programming
You have completed the basic steps necessary to create a data grid view object on a form
and size it appropriately. Next, you’ll preview the data and customize your table. The ability
to preview data and adjust basic settings is made easy by the smart tag feature.
Preview the data bound to a data grid view object
- Select the data grid view object on the form, and then click the smart tag in the
upper-right corner of the object.
Visual Studio displays DataGridView Tasks, a list of common property settings and
commands related to the data grid view object. The DataGridView Tasks list looks
like this:
You can use the settings and commands in this list to change the table that is bound
to the data grid view object and to enable or disable editing within the data grid view.
(The default setting is to give the user limited abilities to edit information in the table,
although you can still control whether the changes he or she makes are written to the
underlying database .) You can also adjust the columns shown, dock (attach) the data
grid view to the parent container (in this case, the form), filter records with a query
(SQL statement), and preview the data in the table.
- Click Preview Data to open the Preview Data dialog box.
You display this dialog box when you want to examine the data in a table before you
actually run the program—a handy feature.