Exercise: WebBrowser control linked to 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 one of more of the courses listed below!

Category ==> Visual C Sharp  (65 exercises)
Topic ==> Coding form events  (1 exercise)
Level ==> Harder than average
Courses ==> Introduction to Visual C#  /  WinForms using 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 a his-and-hers website picker to look as follows (for male users, at any rate):

Visual C Sharp 2010 exercise - Coding form events (image 1)

Every male's secret favourite website: www.cowboyshowcase.com

To achieve this, first create a form called frmWebSite and add a ComboBox and WebBrowser control.

Now attach code to the SelectedIndexChanged event of your combobox to make it work.  Here's a suggestion:

Visual C Sharp 2010 exercise - Coding form events (image 2)

We use an IF condition to determine the person's gender, and display a "relevant" URL

That's it!

This page has 0 threads Add post