Microsoft Developer
DataGridViews exercise
Average difficulty

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: Datagridview for mortgages - conditional formatting, default values set

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

1) Create a new form called frmPerson.
2) Add a datagridview to show a list of mortgage applicants (you will need to have already done the previous exercise on creating an SQL Server Express database).
3) Customise this datagridview so that:
  • Any loan amount of £100,000 or more shows up in pink (clue: use the CellFormatting event)
  • It is impossible to add any new records to the table.
4) Your final datagridview should look like this:
Exercise screen-shot 1263 The loan amount column has also been formatted to show currency values
5) Now amend your datagridview so that it is possible to add new records, but that the default values for them are a mortgage with amount £0 and mortgage type 1 (hint: use the DefaultValuesNeeded event):
Exercise screen-shot 1264 This shows what happens as soon as you click in the new row
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..