Visual Basic | Reacting to DataGridView events exercise | Code validation for a DataGridView

This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

Software ==> Visual Basic  (46 exercises)
Version ==> Any version of VB
Topic ==> Reacting to DataGridView events  (3 exercises)
Level ==> Average difficulty
Subject ==> Visual Basic training
Before you can do this exercise, you'll need to download and unzip this file (if you have any problems doing this, click here for help).

You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

If you haven't already done so in this project, create a data source for the Mortgage Access database in the folder shown above.

Create a form called frmApplicant, and within this create a DataGridView to show mortgage applicants from the Person table:

Visual Basic 2010 exercise - Reacting to DataGridView events (image 1)

The DataGridView, with an alternate row style

Add validation such that when the user enters an invalid amount the application displays an error message, and the user can not leave the cell without correcting the error:

Visual Basic 2010 exercise - Reacting to DataGridView events (image 2)

LOTS is not a valid amount!

If you have time, add code to display a suitable value for the ErrorText property of the current row if the mortgage type id is not an integer between 1 and 5:

Visual Basic 2010 exercise - Reacting to DataGridView events (image 3)

should appear if you enter a mortgage type id of 7, for example, as here

Pat yourself on the back, and close down any open forms.

You can unzip this file to see the answers to this exercise, although please remember this is for your personal use only.
This page has 0 threads Add post