Microsoft Developer
DataGridViews exercise
Relatively easy

This Microsoft Developer DATAGRIDVIEWS exercise is provided to allow potential course delegates to assess their suitability for the Wise Owl VISUAL BASIC 2005 WINDOWS FORMS course only, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

Exercise: Creating a basic DataGridView for showing mortgage types

A full answer to this exercise is provided as part of the training course!

1) Create a new form called frmMortgageTypes.
2) Add a datagridview on to your form to show records from the MortgageType table (you will need to have already done the previous exercise on creating an SQL Server Express database).
3) Format this datagridview - if you want a guide, here is a suggestion to try things out:
Exercise screen-shot 1261 The ID column has been formatted to have a grey font; the font for all parts of the datagridview is Verdana
4) Change the following properties:
  • The datagridview's Anchor property to make the datagridview "stretchy"; and
  • The right-most column's AutoSizeMode property to make it fill the space at the right of the datagridview.
5) Your final datagridview should behave something like this:
Exercise screen-shot 1262 When you resize the datagridview, the last column width changes with it
6) Close down any forms that you have open.

Thank you for showing an interest in this Visual Basic 2005 Windows Forms training course! As mentioned above, full answers to this and other exercises are provided on the course. On all Wise Owl scheduled courses delegates can take away these model answers (together with their own efforts!) on a free USB stick.

All content copyright Wise Owl Business Solutions Ltd 2008.  All rights reserved..