Exercise: Create a DateTimePicker and ComboBox

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.

The answer to the exercise will be included and explained if you attend the Wise Owl courses listed below!

Category ==> Visual C Sharp 2010  (65 exercises)
Topic ==> Creating forms  (2 exercises)
Level ==> Average difficulty
Courses ==> WinForms using Visual C#  /  Introduction to Visual C#

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.

The aim of this exercise is to create an application form for a dating agency.  Create a form alled frmApplicationForm and add controls and formatting so that it looks something like this:

Visual C Sharp 2010 exercise - Creating forms (image 1)

You can choose different colours ...

Your form should include:

  • a ComboBox control (you can use the SelectedItem.Text property of the combobox to find out the user's preference); and
  • a DateTimePicker control (see hint below)

You can use something like dtpDateOfBirth.Value.ToString("dd/MM/yyyy") to get at the date entered.

When a user clicks on Apply now, they should see something like this in a message box:

Visual C Sharp 2010 exercise - Creating forms (image 2)

You should create and display a string of text containing the user's choices

When you're happy that your form works successfully, close it down.

This page has 0 threads Add post