Exercise: Create a form to make it easier to display a message

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 course listed below!

Category ==> Visual Basic 2010  (42 exercises)
Topic ==> Coding in VB.NET  (2 exercises)
Level ==> Average difficulty
Course ==> Introduction to VB.NET
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.

Press CTRL + D to add the file called frmLazyMessageBox.vb from the above folder into your project (or right click on the project and choose to add it as an existing item). 

Change your project's properties to make this the default form for your project.  When you run your project, you should see this:

Lazy message box program

The idea is that you can display a message with the title and contents entered in the form.

Attach code to the left-hand button, and start a command as shown below. Visual Studio will show you the 21 argument signatures that you can choose from:

Message box syntax

Visual Studio will automatically work out which of the 21 signatures you are trying to use.

The idea now is that a user can fill in any message.  For example:

Filling in message parts

One possible message a user might want to share with the world.

Finish the code attached to the Show message button so that it displays a message similar to that shown below:

The resulting message box

Obviously the message's title and contents will depend on what you type into the form.

You can include carriage returns by concatenating your text with VbCrLf.

That's it!  You can now close down any open forms.

This page has 0 threads Add post