Chapter 3 Working with Toolbox Controls 73
can save your projects in any location (the Documents\Visual Studio 2010\Projects folder
is a common location), in this book I instruct you to save your projects in the
C:\Vb10sbs folder, the default location for your Step by Step practice files. If you ever want
to remove all the files associated with this programming course, you’ll know just where
the files are, and you’ll be able to remove them easily by deleting the entire folder.
- Browse to the C:\Vb10sbs\Chap03 folder.
- Click the Select Folder or Open button to open the folder you specified.
- Clear the check mark from the Create Directory For Solution check box if it is selected.
Because this solution contains only one project (which is the case for most of the
solutions in this book), you don’t need to create a separate root folder to hold the
solution files for the project. (However, you can create an extra folder if you want .)
- Click Save to save the project and its files.
Congratulations—you’ve joined the ranks of programmers who’ve written a Hello World
program. Now let’s try another control.
Using the DateTimePicker Control
Some Visual Basic controls display information, and others gather information from the
user or process data behind the scenes. In this exercise, you’ll work with the DateTimePicker
control, which prompts the user for a date or time by using a graphical calendar with scroll
arrows. Although your use of the control will be rudimentary at this point, experimenting
with DateTimePicker will give you an idea of how much Visual Basic controls can do for you
automatically and how you process the information that comes from them.
The Birthday Program
The Birthday program uses a DateTimePicker control and a Button control to prompt the user
for the date of his or her birthday. It then displays that information by using a message box.
Give it a try now.
Build the Birthday program
- On the File menu, click Close Project to close the MyHello project.
The files associated with the Hello World program close.
- On the File menu, click New Project.
The New Project dialog box opens.
- Create a new Visual Basic Windows Forms Application project named MyBirthday.
The new project is created, and a blank form appears in the Designer.