Chapter 4 Working with Menus, Toolbars, and Dialog Boxes 107
TABLE 4-1 System Clock Properties and Methods
Property or Method Description
TimeString This property sets or returns the current time from the
system clock.
DateString This property sets or returns the current date from the
system clock.
Now This property returns an encoded value representing the
current date and time. This property is most useful as
an argument for other system clock functions.
Hour (date) This method extracts the hour portion of the specified
date/time value (0 through 23).
Minute (date) This method extracts the minute portion of the specified
date/time value (0 through 59).
Second (date) This method extracts the second portion of the specified
date/time value (0 through 59).
Month (date) This method extracts a whole number representing the
month (1 through 12).
Year (date) This method extracts the year portion of the specified
date/time value.
Weekday (date) This method extracts a whole number representing the day
of the week (1 is Sunday, 2 is Monday, and so on).
Adding Toolbars with the ToolStrip Control
Parallel to the MenuStrip control, you can use the Visual Studio ToolStrip control to quickly
add toolbars to your program’s user interface. The ToolStrip control is placed on a Visual Basic
form but resides in the component tray in the IDE, just like the MenuStrip control. You can also
add a variety of features to your toolbars, including labels, combo boxes, text boxes, and split
buttons. Toolbars look especially exciting when you add them, but remember that as with menu
commands, you must write an event procedure for each button that you want to use in your
program. Still, compared with earlier versions of Visual Basic, it is amazing how much toolbar
programming and configuring the IDE does for you. Practice creating a toolbar now.
Create a toolbar
- Click the ToolStrip control on the Menus & Toolbars tab of the Toolbox, and then draw
a toolbar control on your form.
Don’t worry about the location—Visual Studio will create a toolbar on your form
automatically and extend it across the window. The tool strip object itself appears
below the form in the component tray. On the form, the default toolbar contains one
button. Now you’ll use a special shortcut feature to populate the toolbar automatically.