(Ebook) Advanced Programming Using Visual Basic 2008 by Julia Case Bradley, Anita Millspaugh ISBN 9780073517223, 0073517224
(Ebook) Advanced Programming Using Visual Basic 2008 by Julia Case Bradley, Anita Millspaugh ISBN 9780073517223, 0073517224
ebooknice.com
https://ebooknice.com/product/programming-in-visual-c-2008-10966170
ebooknice.com
ebooknice.com
ebooknice.com
(Ebook) An introduction to programming using Visual Basic
2008: with Visual Studio Expression edition DVD by
Schneider, David I ISBN 9780136060727, 9782008023533,
0136060722, 2008023532
https://ebooknice.com/product/an-introduction-to-programming-using-
visual-basic-2008-with-visual-studio-expression-edition-dvd-22041544
ebooknice.com
ebooknice.com
ebooknice.com
https://ebooknice.com/product/sat-ii-success-
math-1c-and-2c-2002-peterson-s-sat-ii-success-1722018
ebooknice.com
ebooknice.com
Advanced Programming Using Visual Basic 2008 4th
Edition Julia Case Bradley Digital Instant Download
Author(s): Julia Case Bradley, Anita Millspaugh
ISBN(s): 9780073517223, 0073517224
Edition: 4
File Details: PDF, 18.42 MB
Year: 2009
Language: english
Computer and Information Technology
Bradley−Millspaugh
McGraw-Hill
=>?
McGraw−Hill Primis
ISBN−10: 0−39−012228−9
ISBN−13: 978−0−39−012228−5
Text:
http://www.primisonline.com
Copyright ©2009 by The McGraw−Hill Companies, Inc. All rights
reserved. Printed in the United States of America. Except as
permitted under the United States Copyright Act of 1976, no part
of this publication may be reproduced or distributed in any form
or by any means, or stored in a database or retrieval system,
without prior written permission of the publisher.
Contents
Front Matter 1
Preface 1
To the Student 9
6. Services 259
Text 259
iii
9. Reports 413
Text 413
iv
Bradley−Millspaugh: Front Matter Preface © The McGraw−Hill 1
Advanced Programming Companies, 2010
Using Visual Basic 2008
PREFACE
Visual Basic (VB) has become the most popular programming language for
several reasons. VB is easy to learn, which makes it an excellent tool for un-
derstanding programming concepts. In addition, it has evolved into such a
powerful and popular product that skilled Visual Basic programmers are in
demand in the job market.
Visual Basic 2008, the latest version of VB, has many new features, espe-
cially in queries and Web application development. Visual Basic is designed
to allow the programmer to develop applications that run under Windows
and/or in a Web browser without the complexity generally associated with
programming.
This edition of the text is updated to Visual Studio 2008, .NET 3.5, and
ASP.NET 3.5. The screen captures are based on Windows Vista, but all pro-
grams can be run in Windows XP, although the special effects of WPF cannot
be seen in XP.
Approach
Chapter topics are presented in a sequence that allows the programmer to learn
how to deal with a visual interface while acquiring important programming
skills such as accessing and updating data in a relational database, developing
applications for the Web and for mobile devices, and adding browser-based
Help files to an application.
The chapters may be used in various sequences to accommodate the needs
of the course, as well as a shorter quarter system or a semester-long course.
Pub ID: Pub_idTextBox 7. Retrieve and display an array of child rows for a selected parent row.
Hire Date: Hire_dateTextBox
8. Create an application that displays data from a many-to-many relationship.
9. Select the correct locations for handling and formatting data in a multitier application.
Plan the Objects, Properties, and Methods Plan the two tiers. Determine the
objects and property settings for the form and its controls and for the data-tier
component. Figure 3.31 shows a diagram of the components in the two tiers.
Presentation Tier
EmployeeForm Name
Text
EmployeeForm
Employees Learning Objectives
FullNameComboBox Name FullNameComboBox
Text boxes for all database
fields (including Hire Date)
Specific objectives tell students what
will be covered in the chapter and
what they will be able to do after
completing the chapter.
TIP
➤ Feedback 4.2 If the drop-down arrows do not
1. What Fill method statements are created for a relationship for appear in the Data Sources window,
Customers and Orders? Assume that the project contains two make sure that you have a form
TableAdapters called CustomersTableAdapter and OrdersTableAdapter displaying in the designer. ■
as well as a DataSet called NorthwindDataSet.
2. How can you view the relationship between two tables?
3. Describe the necessary steps to display the job description from the
jobs table rather than the job id when displaying the employee table.
TIPs
Feedback Questions Tips, found in the margins throughout
the text, help students avoid potential
Feedback questions encourage students to reflect on trouble spots in their programs and
the topics covered and evaluate their understanding of encourage them to develop good
details relating to that topic. programming habits.
Bradley−Millspaugh: Front Matter Preface © The McGraw−Hill 3
Advanced Programming Companies, 2010
Using Visual Basic 2008
Case Studies files have the same name, you are prompted to select the file to keep. A check
box allows you to show the deleted files since the last copy operation.
See “How to: Copy Web Site Files with the Copy Web Site Tool” in MSDN for
steps to copy all files at once, copy files individually, or synchronize files.
Claytor’s Cottages
Modify your Claytor’s Cottages case study project to the room has a Jacuzzi, Private access, and/or Fire-
Publishing a Web Site
display the room information. The Room form should place. Display the Bed type and the room rates from
display for the Edit / Rooms menu item. the Beds table. The Publish Web Site utility precompiles the Web pages and code content. The
On the Room form, include a combo box that Hint: You can bind the checked property of a compilation process removes the source code from the files and leaves only
holds the room name. Use check boxes to indicate if check box to a Boolean data field. stub files and compiled assemblies for the pages. You can specify the output
location as either a directory or a server location.
Precompiling the Web pages offers a couple of advantages over just copy-
ing the pages. One advantage is response speed. When pages are just copied to
Christian’s Car Rentals
a site, they must compile when a request is made for the page. Not having the
Modify your case study application to display the price and mileage rate in text boxes. The related mod- source code on the site also provides some security. During the publish pro-
vehicle information. Display a combo box that contains els and manufacturer should display in a grid. cess, you have the option of having markup protection, which does not allow for
the car sizes. When the user selects a size, display the later updates to the pages. If you opt to not have the files updatable, the code
in single-file pages is deployed as source code rather than being compiled into
an assembly.
vi P R E F A C E
Many topics from the introductory course are presented in greater detail
and demand more from the students. Many other advanced topics are pre-
sented, including displaying and updating relational databases, WCF Services,
data structures, user controls, Help files, and mobile application development
for Windows devices, along with expanded coverage of cascading style sheets
and AJAX for Web development.
This edition now includes coverage of the many new features in Visual
Studio including LINQ, WPF, and WCF. Both LINQ and WPF have been
placed in Chapter 13, the “Additional Topics” chapter, allowing you to cover
them at any point in the course.
The layout for Web pages uses the preferred method of incorporating <div>
for sections and all formatting with styles. Tables are only used within a <div>.
P R E F A C E vii
Chapter Organization
Each chapter begins with identifiable objectives and a brief overview. Numer-
ous coding examples as well as hands-on projects with guidance for the coding
appear throughout. Thought-provoking feedback questions give students time
to reflect on the current topic and to evaluate their understanding of the de-
tails. The end-of-chapter items include key terms, a chapter review, questions,
programming exercises, and two case studies. The case studies provide a
continuing-theme exercise that may be used throughout the course. The
in-chapter programs are included on the student Web site, allowing the student
to test and modify existing code. Of course, it is also important to develop a
complete application from scratch to really learn the programming techniques.
Chapter 1, “Visual Studio and the .NET Framework,” discusses the
features of the Visual Studio IDE and the .NET Framework. Applications
demonstrate how to display data from the AssemblyInfo.vb file using the
My object. MDI projects, toolbars, and status bars are reviewed.
Chapter 2, “Building Multitier Programs with Classes,” reviews
object-oriented terminology, creating classes, and instantiating objects.
Creating and throwing exceptions from the business services tier is
introduced. The ErrorProvider and TryParse are demonstrated to
improve the efficiency of validation in the presentation tier.
Chapter 3, “Windows Database Applications,” explains the
relationship of datasets, tables, rows, and constraints. Database
applications use SQL Server databases to display information in grids,
combo boxes, labels, and the database display controls.
6 Bradley−Millspaugh: Front Matter Preface © The McGraw−Hill
Advanced Programming Companies, 2010
Using Visual Basic 2008
viii P R E F A C E
P R E F A C E ix
Acknowledgments
We would like to express our appreciation to the many people who have con-
tributed to the successful completion of this text. Most especially, we thank the
students at Mt. San Antonio College who helped class-test the material and
who greatly influenced the manuscript.
Many people have worked very hard to design and produce this text.
We would like to thank our editors Liz Haefele, Scott Davidson, and Alaina
Grayson. Our thanks also to the many people who produced this text including
Marlena Pechan, and Betsy Blumenthal.
We greatly appreciate John Blyzka, Peter van der Goes, and Robert Price
for their thorough technical reviews, constructive criticism, and many valuable
suggestions. And most importantly, we are grateful to Dennis and Richard for
their support and understanding through the long days and busy phone lines.
8 Notes
Bradley−Millspaugh: Front Matter To the Student © The McGraw−Hill 9
Advanced Programming Companies, 2010
Using Visual Basic 2008
TO THE STUDENT
Welcome to the exciting new features of Visual Basic 2008. You have probably
already learned that the best way to learn how to program is to actually sit at
a computer and write code, change things, and test it again. Stepping through
existing code is also a great tool in learning new techniques. With that in mind,
we have included all of the code from the examples within the chapters on your
student text Web site. Please feel free to load the programs, change things, and
test it again.
But . . . if you really want to learn how it works, it is critical that you create
a blank project and try the techniques yourself. If you run into a problem, take
a look at the sample and compare properties and code.
There are several tools in this text to help you on your way.
• Each chapter begins with a list of topics and ends with a summary. Com-
bine these for a thumbnail review of the chapter. Understanding the ter-
minology is an important part of learning any new language, which is also
true with programming languages.
• A list of key terms is at the end of each chapter. Each of those terms is in
boldface within the chapter. There is also a glossary at the end of the text
where you can look up the definition of the terms.
• Test yourself with the Feedback questions as you work through each sec-
tion of a chapter. The review questions at the end of the chapter can test
your understanding of the topics.
• Tips are included to give suggestions in situations where you may run into
problems caused by the version of software installed/not installed or with
settings.
• Make sure to check out the appendixes, which hold a wealth of support
material.
J.C.B.
A.C.M.
xi
10 Notes
Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill 11
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008
Try
With StoresBindingSource
C H .EndEdit()
A P T E R
.AddNew()
1 End With
AddingBoolean = True
SetComboBoxBinding()
Stor_nameComboBox.Focus()
SetControlsReadOnly(False)
PreviousSelectedIndex = 0
End If
at the completion of this chapter, you will be able to . . .
1. Distinguish the features of the Visual Studio IDE and the .NET Framework.
2. Identify and understand the purpose of each of the files listed in the Solution Explorer.
5. Create an MDI project with a parent form, child forms, a toolbar, status bar, context menus,
and ToolTips.
6. Use the singleton design pattern to create a class that should be instantiated only once.
12 Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008
C H A P T E R 1 3
System.IO Types for reading and writing data streams and files.
The classes in the library comply with published standards known as the
Common Language Specification (CLS). The CLS specifies how a lan-
guage that interacts with the CLR should behave. If you want a program to in-
teract with programs and components written in other languages, you should
make sure that it is CLS compliant. The rules for CLS compliance can be found
in the .NET Framework Developer’s Guide under the heading “Writing CLS-
Compliant Code.” Note that all VB programs that you write using the VS IDE
will be CLS compliant automatically.
Types
The .NET documentation uses the general term types to refer to the classes,
structures, enumerations, delegates, interfaces, and data types in the library, as
well as any that you define. You can think of a type as any element that you can
use in the As clause of a declaration:
treat the variables when you assign one variable to another. For example, if you
assign one integer variable to another, you have two memory locations with the
same value:
SecondValueInteger = FirstValueInteger
However, if you assign one reference type to another, you have two variables
that point to the same object in memory:
SecondForm = FirstForm ' Assign reference for first form to second form.
Any changes that you make to either variable are made to the one object in
memory to which both variables refer. In some previous versions of VB, refer-
ence types were called object variables. However, VB reference types include
more types than the more restrictive object variables.
Can you predict the debug output from the two groups of statements above?
Follow the logic and write down your answer; then look back here to check
your understanding.
FirstValueInteger = 5; SecondValueInteger = 10
FirstForm = New Caption for First Form; SecondForm = New Caption for First Form
All numeric data types are value types. Reference types include class types,
arrays (even if the individual elements are numeric), and strings. A value type
always holds a value; when you declare a new variable of a value type, the vari-
able is always initialized, either to a value that you supply or to the default value.
A reference type may or may not hold a value; you can use the IsNot Nothing
condition to determine whether the variable refers to an instance of an object.
C H A P T E R 1 5
Assemblies
An assembly is a basic unit of code that may be a single PE file or multiple
files. Each of your applications will be contained in a single assembly, which
is the smallest deployable piece of code. An assembly has an assembly man-
ifest that contains metadata about the version, a table describing all of the
files needed by the assembly, and an “assembly reference list” that specifies
all of the external files needed, such as DLLs created by someone else. An
assembly is similar to an .exe or a .dll file written in earlier versions of Visual
Basic—it contains all of the necessary information to run the application or
component.
Recall that the .NET Framework class library is not one big file but
rather a collection of files. The classes are stored in many files with the ex-
tension .dll and referred to as DLLs (for dynamic link libraries). Each of the
DLLs in the class library is one assembly. As your program begins execu-
tion, only the needed assemblies are loaded into memory. When you want to
use a type that is not already referenced, you must add a reference to the
DLL (assembly).
Attributes
Attributes are tags containing information about parts of a program such as
types or methods. The system defines many attributes of your assembly, such
as the name, version, culture, and security. The attributes are part of the meta-
data in a .NET assembly. The process of examining the metadata in an assem-
bly’s attributes is called reflection.
Later in this chapter, you will learn to retrieve and use the custom attri-
butes in a project’s assembly information, which is stored in the Assembly-
Info.vb file.
ASP.NET
Another big part of the .NET world is the improvement in Web development.
ASP.NET 3.5 is the newest version of Active Server Pages (ASP). It is a Web
development environment that can compile applications written in any .NET-
compatible language including Visual Basic. This means that the benefits of the
common language runtime and managed code are available for developing Web
applications. ASP.NET makes Web development easier by providing the same
debugging support for Web Forms and Web Services as for Windows applications.
You will begin working with ASP.NET in Chapter 7. Chapters 8 and 9
cover accessing databases from ASP.NET, which is a common technique for
displaying data on a Web site.
➤ Feedback 1.1
1. What is meant by the term .NET Framework?
2. What are the meaning and function of each of these terms?
a. CLR
b. CLS
c. MSIL
d. PE
3. What is the difference between a reference type and a value type? Why
is it important to know the difference?
Visual Studio
Although you could write your programs in any editor and then use the VB com-
piler to compile them, Visual Studio provides an environment to make your devel-
opment task easier. You should already be familiar with the various windows in the
environment as well as the basic debugging capabilities. For a review of the VS
IDE, as well as tips and shortcuts, see Appendix D. This section introduces you to
more details about the parts of a project and changes to the VS environment.
Note: This chapter introduces writing Windows applications. You also have
the option of writing Windows Presentation Foundation (WPF) applications.
Although WPF applications are introduced in Chapter 13, you might prefer to
begin there and write all of your programs using WPF.
Temporary Projects
You can create temporary projects for testing, without saving them. This can be
both good and bad: You don’t have to clutter your drive with small projects that
you create just to test something, but you may forget to save a project that you
wanted to keep.
When you create a new project, by default it is a temporary project, which
VS stores in a temporary folder on the hard drive. So even when you compile
and run the project, the compiler saves the files in the temporary folder. When
you exit VS or choose to begin another project, you are presented with the
option to save or discard the project (Figure 1.2).
If you want to always save new projects, you can select that option in the
Options dialog box. Choose Tools / Options / Projects and Solutions and select
Save new projects when created.
Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill 17
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008
C H A P T E R 1 7
Figure 1.2
bin\Debug folder
obj folder
Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill 19
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008
C H A P T E R 1 9
hidden files and folders. The My Project folder holds several files for project
configuration, including AssemblyInfo.vb. You will learn to view and set con-
figuration options in the Project Designer, which is discussed in the “The
Project Designer” section later in this chapter.
In Figure 1.4, you can see the expanded References collection, the bin and
obj folders, and the form files for Form1.vb. You can expand each of the nodes
to see more details. Note that the solution name does not display by default. To
show the solution name, as in Figure 1.4, select Tools / Options / Projects and
Solutions and check Always show solution. You will want to always show solu-
tions so that you can edit solution names.
References
In the References folder, you can see a list of System libraries (DLLs), such as
System, System.Deployment, System.Drawing, and System.Windows.Forms.
These are the references included by default for a new Windows application.
You can add a reference by right-clicking on the References folder and select-
ing Add Reference from the context menu. You also can add references in the
Project Designer, which is discussed a little later. You may need to add a refer-
ence if you want to refer to objects in another assembly or components written
in a different language.
The executable
Debugging information
20 Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008
The project’s .exe file is the executable, which is used to run the program; the
.pdb file holds debugging information. If you are distributing your application,
you only need to distribute the .exe file, not the .pdb file. The ProjectName.
vshost.exe file is a small application that runs the project in the environment.
Project Resources
The Resources folder holds resources that you add to your project. Figure 1.6
shows a graphic file stored in the Resources folder; you can also add sound
files and text strings to the resources.
Figure 1.6
Visual Studio provides several ways to add resources to the folder and to
access those resources. You can add resources in the Project Designer, dis-
cussed later in this chapter. You also can add resources from the Properties
window, such as when you set the Image property of a PictureBox control. At
design time, you can assign properties of controls to resources that are in the
Resources folder, and you can retrieve resources at run time using the My.Re-
sources object, which also is discussed later in this chapter.
Each form in your project also has a resource file, which has a .resx exten-
sion. For example, Form1.vb has a Form1.resx file, which you can see in the
Solution Explorer when you click on the Show All Files button and expand the
form’s node.
The .resx file is mostly text in XML format, which you can open and view
in the IDE. The .resx file holds pointers to the files in your Resources folder
and supplies the resources to the form at compile time. Any graphic elements
that you add to the form, such as a PictureBox’s Image property or a form’s
Icon property, also are stored in the .resx file in text that represents the binary
graphic file.
If you rename your form file in the Solution Explorer, the .resx file is auto-
matically renamed to match. At times you may find extra .resx files in the
project’s folder; you can safely delete any extra .resx files if their names do not
match any forms in the project.
Image Files in Visual Studio 2008 Microsoft is including many graphic files
with Visual Studio 2008. The graphics are those used in Windows so that you
can make your applications use the standard images. The default location for
Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill 21
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008
C H A P T E R 1 11
Partial Classes
Partial classes, also called partial types, is a feature that was added in the
2005 version of Visual Studio. In its simplest form, partial classes allow you to
split a class into two or more separate files.
Programmer-written VB code
Designer-generated VB code
Resource file for the form
The file that holds the designer-generated code includes the class inheri-
tance information:
The partial class instantiates the form and the visual components for the
form as well as stores property settings.
The form’s class file that holds the programmer-written code begins with
this line:
The compiler uses the statements in both files to create the compiled class.
Note that you can create multiple partial class files and one single file without
the “Partial” designation.
22 Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008
Display the Project Designer by double-clicking on the My Project folder in the Solution Explorer.
Assembly
information
The Application Tab The Application tab is the default tab that appears on top
when you open the Project Designer. On the Application tab, you can set the ap-
plication type, the startup form, the icon, and the splash screen. You also can
display and set the application’s assembly information from this dialog. Later
in this chapter, we will use many of these options.
The Compile Tab On the Compile tab, you can set the path for the compiler
output. You also can alter the settings for Option Explicit and Option Strict
and specify which errors should be flagged by the compiler and which should
be ignored.
The References Tab The References tab displays the names and paths for the
project references. You can add and remove references to Windows or Web
library components, as well as external components, in this dialog.
The Resources Tab The Resources tab allows you to easily add and remove the
graphic files that you use for picture boxes and toolbars, any sound files, and
text strings in various languages to use for localization.
Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill 23
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008
C H A P T E R 1 13
The Signing, Security, and Publish Tabs The settings on the Signing, Security,
and Publish tabs are used for ClickOnce deployment. Using ClickOnce deploy-
ment, you can set up applications to be deployed and updated on multiple sites
via the Web. This technique is primarily used by large organizations to facili-
tate deploying applications to many users.
The VB My Objects
The Visual Basic My object provides several objects and properties. My gives
you easy access to information about your application and its resources, the
computer on which the application is executing, and the current user.
It is easy to discover the available objects using IntelliSense (Figure 1.9):
Application, Computer, Forms, Resources, Settings, User, and Web Services.
Figure 1.9
You can retrieve information about the user’s computer, operating system,
and amount of memory with My.Computer.Info (Figure 1.10).
If you want to know the name of the user, you can use
UserNameString = My.User.Name
In the following section, you will use My.Application to retrieve the assem-
bly information about an application.
Figure 1.10
Use My.Computer.Info to
retrieve information about
the user’s computer.
Figure 1.11
C H A P T E R 1 15
Figure 1.12
Type appropriate entries for your applications. Figure 1.12 shows the as-
sembly information for the chapter hands-on example program.
Another way to modify a project’s assembly information is to edit the
AssemblyInfo.vb file directly. You can see the file in the Solution Explorer
beneath the My Project folder when Show All Files is selected (Figure 1.13).
Double-click the filename to display the file in the editor.
Figure 1.13
You can modify the assembly information by editing the AssemblyInfo.vb file.
26 Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008
TitleLabel.Text = My.Application.Info.Title
C H A P T E R 1 17
Write the code to assign values to the labels in the Form_Load event
procedure. The code uses the My.Application.Info object to retrieve the
attributes.
With My.Application.Info
NameLabel.Text = .AssemblyName
TitleLabel.Text = .Title
DescriptionLabel.Text = .Description
CompanyLabel.Text = .CompanyName
ProductLabel.Text = .ProductName
VersionLabel.Text = "Version: " & .Version.ToString
CopyrightLabel.Text = .Copyright
End With
End Sub
Figure 1.15
➤ Feedback 1.2
Write the statements necessary to retrieve and display the copyright attribute
in CopyrightLabel.
The MenuStrip,
ContextMenuStrip, ToolStrip,
and StatusStrip components
are grouped together in the
Menus & Toolbars section of
the toolbox.
C H A P T E R 1 19
You can use the MenuStrip’s smart tag (Figure 1.20) to set some properties of
the menu bar. Select Edit Items to open the Items Collection Editor (Figure 1.21),
where you can set properties of the menu items, and add, remove, and rearrange
the items.
When you use the visual menu designer to create menus and menu items,
each item is automatically given a meaningful name. But if you add a menu
item in the Items Collection Editor, you must name the item yourself.
Figure 1.20
TIP
The keyboard shortcut for opening
a smart tag when its arrow appears
is Alt + Shift + F10. ■
Figure 1.21
In the Items Collection Editor, you can add and remove menu items, reorder items, and set properties of the items.
You can edit any of the items by selecting it in the Members list. Figure 1.22
shows the FileToolStripMenuItem selected. Notice that the top right now indicates
the selected item and that one of the properties of the FileToolStripMenuItem is a
DropDownItems collection. If you select that collection, the Items Collection
Figure 1.22
Edit the properties of the individual menu items in the Items Collection Editor. Notice that the FileToolStripMenuItem has a
DropDownItems property, which is a collection of the menu items that appear below the File menu.
FileToolStripMenuItem is selected
C H A P T E R 1 21
Editor displays the items beneath the File menu. Also notice in Figure 1.22 that
the right side of the Items Collection Editor is similar to the Properties window in
the IDE. You can click on the buttons to display the properties in alphabetic order
or categorized view.
Figure 1.23
The ContextMenuStrip component appears in the component tray. When it is selected, the visual menu designer appears to
allow you to enter menu items.
A context menu does not include a top-level menu name; instead each of the
items belongs to the Items collection of the ContextMenuStrip. Notice that the
smart tag arrow appears on the component in the component tray, rather than on
the menu in the designer. You can select Edit Items from the smart tag or select
the Items property in the Properties window to edit the individual menu items.
The form and each of the controls that you add to the form has a Context-
MenuStrip property. You assign the context menu to the form or control by se-
lecting its name in the Properties window. Note that you can add multiple
context menus to the component tray and assign each to a different control.
If you assign a context menu to a form, it becomes the default context menu
for the form and most controls on the form. However, controls that allow text
entry, such as text boxes and combo boxes, have a default context menu that
contains the editing items Cut, Copy, and Paste. If you assign your own context
menu to a text control, you will lose the items on the default context menu.
You can easily assign a single event handler to both a menu item and a
context menu item. Add the second item to the Handles clause of the event
handler. In the following example, the event handler is executed for the Click
32 Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008
event of both the menu item and context menu item. Note that the menu
designer named the context menu item with the same name as the menu item,
with the addition of the numeral “1”.
Me.Close()
End Sub
Figure 1.24
The ToolStrip component appears in the component tray. You can drop down the list for the types of buttons and controls that
you can add to the ToolStrip.
After you add the buttons to the ToolStrip container, you can set the prop-
erties of each button in the Properties window or in the Items Collection Editor, TIP
which you display from the smart tag. You will need to give the toolbar buttons Set the ToolTipText property of each
meaningful names; the visual designer assigns names like ToolStripButton1. toolbar button to aid the user, in
Your buttons can hold an image, text, or both. Generally you will want to case the meaning of each graphic is
place an image on the button and set the ToolTip text to indicate the purpose of not perfectly clear. ■
Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill 33
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008
C H A P T E R 1 23
Figure 1.25
Set the Name, Image, and ToolTipText properties for each ToolStripButton.
ToolTip
Name
DateToolStripStatusLabel.Text = Today.ToShortDateString
TimeToolStripStatusLabel.Text = Now.ToLongTimeString
End Sub
34 Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008
Figure 1.26
DateToolStripStatusLabel.Text = Today.ToShortDateString
TimeToolStripStatusLabel.Text = Now.ToLongTimeString
End Sub
Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill 35
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008
C H A P T E R 1 25
➤ Feedback 1.3
What steps are necessary to display the current time in a StatusStrip label
called CurrentTimeStatusStripLabel?
MDI Applications
In this section, you will create a multiple document application with parent
and child forms, a menu bar, context menus, a toolbar, and a status bar.
With MDI, a parent and child relationship exists between the main form
and the child forms. One of the rules for MDI is that if a parent form closes, all
of its children leave with it—a pretty good rule. Another rule is that children
cannot wander out of the parent’s area; the child form always appears inside
the parent’s area.
VB allows you to have forms that act independently from each other. You
may have a parent form and several child forms and some forms that operate
independently. For example, a splash form likely should remain SDI.
One feature of MDI is that you can have several child windows open at the
same time. The menu bar generally contains a Window menu that allows you to
display a list of open windows and move from one active window to another.
Exploring the Variety of Random
Documents with Different Content
was of a stouter spirit than Harry’s wife. She preferred, even at a risk
of great pain, to make trial quietly of this new life, rather than to say
how irksome to her was the prospect of burdening her brother, and
to undergo a scene of indignation, and grief, and reconcilement.
Nevertheless, Martha felt her influence abridged, and was silent—for
this fortune did not change her own position or that of her sisters.
Harry and his wife alone were rightful sharers of this unexpected
elevation, and Martha stepped down from the elder sister’s place,
not without a struggle, and endeavoured to turn her eyes, which had
so long expressed the distinct decisions of a separate will, towards
the young irresolute pair beside her as to the heads of the house.
“Why don’t you speak, Martha?” exclaimed Harry at last, noticing
her silence with a renewed burst of impatience. “Why don’t you say
what you think at once, instead of sitting glooming at us all?”
“I do not speak because I begin now to be your dependant, Harry,”
said Martha, with harsh emphasis; “and especially in a matter where
I and these bairns may restrict and hinder you, must now choose to
listen to your decision, and not try to influence it. That is why I do not
speak. But what I think is, that Agnes, since she wishes it, should go
with you, and that we can remain to do all that is necessary here. Or
I can take them home to Ayr—anywhere—and Agnes will like to be
with you in your plannings and alterations, Harry. Why should she
not go?”
“A dependant!” Harry looked very indignant and injured.
“Stay,” said Martha. “Nothing more of this. A woman needs to be
so. I am willing; but I prefer that nothing should be said of it, Harry,
especially now, when I am scarcely accustomed to the change.”
A long silence followed, and each individual heart there was busy
with its own proper thoughts. Martha, ever proud and harsh,
repeated to herself the many necessities which compelled her to
remain an inmate of Harry’s house, and to relinquish the work by
which she had hitherto supported herself—she, who, small as her
opportunities were, had always conferred, but never received, the
benefits of ordinary life; and there came vividly upon her memory
those old dreams of youth, in which she had imagined herself the
support, the guardian, the protector of the orphan children who were
her charge in the world. Now she was Harry’s dependant sister,
curbing and burdening his hands, and restraining the harmless
indulgences he longed for. Martha was not content, not willing, not
ready, like a gentler woman, to take upon herself this gracious yoke
of love, and receive with sweet and becoming humility the gifts which
she could not refuse; but she bent her stubborn neck to them, and
reminded herself of her new position, with a strong resolve to do all
its duties—chiefest of all to cover over in her own heart, so that no
one could discern it, the bitterness she felt.
Harry, pleased to find himself not only the most important person in
the household, but the maintainer and the acknowledged head of all,
and only half angry that Martha should speak of herself as his
dependant: Agnes, thinking solely that now she had gained her point,
and should go with him to Allenders; Rose, full of new fears and new
hopes, unwilling to realize all that was in her mind; and little Lettie,
last of all, chivalrously determined to win, by some unknown means,
a fortune and fame for her sisters, far better than Harry’s,
surrounded this centre figure of the family group. In all minds there
was a vague dissatisfaction. This great inheritance, after all, like
everything else which deeply disturbs a life, brought new troubles, no
less than new pleasures, in its train.
But Harry made no further resistance to Agnes’s desire. An
involuntary consciousness that it would be ungracious and unkind to
decide contrary to Martha’s opinion, after she had acknowledged his
authority, had greater effect upon his impulsive mind than the
reasonable wish of his wife; for Harry came to do much of what was
really right in his conduct by side motives and impulses, and oftener
made a start in his direct course by an impetus from some diverging
way, than kept steadily on, because he knew that his path was the
straight one. But Agnes did not pause to consider the motive. It was
enough to her that her point was gained.
CHAPTER VI.
nursery rhyme.
It is a bright May day, and the home-garden at Ayr is as bright as
the season. Upon the fresh soft breeze the falling petals of the apple
blossoms sweep down, fluttering like snowflakes to the ground; and
the great pear tree trained against the wall is flushed to the extremity
of every bough, and has its leaves smothered in its wealth of bloom.
By the door here, in the sunshine, is the chair in which Alexander
Muir presides over his little flock of workers, and a book held open
by his spectacles still rests upon it; but the old man himself is not
here. Neither are the girls here, you would say at the first glance; but
look closer into the shady corners, and listen only five minutes—it is
all you need to discover your mistake. There are pleasant sounds in
the air; softened young voices and light-hearted laughter; and at the
foot of Uncle Sandy’s chair lies a heap of muslin, ballasted with
stones, to keep it safe and preserve it from being blown away; for
Beatie and her sisterhood are idle, extremely idle, and idle even, it
must be confessed, is Rose, the viceroy, to whom Uncle Sandy has
delegated his charge. They are whispering together, little groups of
bright heads, which here and there, the sunshine, stretching over the
boughs of the great plane tree, finds out and seizes on, tracing a
single curl or braid of hair with delicate gold, and throwing wavy
shadows over brow and face. They are dispersed in all the corners
of the garden; but here, leaning against the trunk of the plane tree,
flushed with natural gratification, confidential and yet dignified,
stands Rose Muir, the centre of the most important group.
Once these girls were little Rosie’s playmates; now, though Rose is
not proud, she feels no less than they do, that there is a difference,
and quite acquiesces when they call her Miss Rose, and are
respectful as well as friendly. She is standing, with a little of a
patroness air, listening while Mary Burness tells of Maggie
Crawford’s “lad,” and Maggie retaliates by a rumour that Mary is to
be “cried” in the kirk the very next Sabbath day. Rose laughs a little,
blushes a little, and looks so happy and light-hearted, that you
perceive at once she could not tell you why—but that there is some
unconscious reason of still greater might than the family good
fortune which brings back the natural joy so freshly to her heart.
By this open window you hear the sound of voices graver and less
youthful. Within, with her hand wandering among the old man’s
books, sits Martha Muir. Her other hand holds a piece of her
accustomed work, but it lies on her knee listlessly; and with the
unconsciousness of pre-occupation she turns over and over the
books upon the window-shelf—old familiar books, friends which
nurtured and strengthened her own youth—but her hand wanders
over them as though they were strangers, and she could not tell you
what she looks at with those fixed eyes.
“I hope it is all over, uncle,” said Martha, slowly; “I trust it is—I trust
it is. He has had hard lessons, many of them, and a great and
sudden deliverance. The news of it came to me like an angel from
heaven—for I felt that it might save Harry; and so, I hope, I trust it
will.”
“You hope, you trust? we all do that, Martha, my woman,” said the
old man, anxiously. “I never kent an evil-doing stranger yet that I
would not have given all the strength of my good wishes to; but,
Martha, God has given you a clearer judgment than many. What
think ye? what does your ain mind decide as the most likely end?”
“God knows!” said Martha, solemnly. “I think nothing, uncle; I only
trust and hope. I see no sin in him now—poor Harry! poor Harry! and
God send the evil may pass away like the fearful dream, I sometimes
believe it is. Do you mind him, uncle—do you mind the pure, grand
boy he was? Oh, my Harry! my poor Harry!—but I speak as if I was
despairing, when, indeed, I am full of hope,” said Martha, looking up
with a faint smile, through the unusual tears which only moistened
her dried eyelids, but did not fall.
The old man looked at her doubtfully, with serious and earnest
anxiety. She did not lift her eyes, neither did she seem inclined to
say more; but her hand went wandering, wandering, over the books
she knew so well, opening and closing them with such unconscious
fingers, and mind so intently preoccupied, that he shook his head as
he turned away, with a prayer, and a pang in his heart. For
experience, alas! spoke to him as it spoke to her—sadly, hopelessly;
and with Martha he turned from the subject, and would not think—
would only trust and hope.
“And the other bairns,” said the old man, half questioning her, half
consoling himself, “the other bairns; they at least bring us nothing but
comfort.”
“Uncle,” said Martha, looking up with quick curiosity, “what brings
this Mr. Charteris to Ayr? what is his business here? We meet him
wherever we go; what does he want in your house or with us?”
“What is it ye say, Martha?”
Alexander Muir looked up with an awakened face, and glanced out
through the framework of leaves and blossoms round the window to
where his niece Rose stood under the great plane tree.
“Hush! look at them!” said Martha, grasping her uncle’s arm with
her hand, and bending forward eagerly, as if the gesture made her
hear as well as see.
There is a stranger in the garden, lingering beside the vacant chair
on the threshold, looking wistfully into the shaded corner, with its
waving boughs and pursuing sunshine. Just now they are talking
rather loud yonder, and laughing with unrestrained glee; and still it is
stories of courtship and mirthful wooing which are told to Rose, and
still she stands listening, well pleased, with smiles on her face, and
in her heart. Rose could not tell you what it is that makes her step so
light, her heart so free. It is something which touches duller
pleasures into life, and kindles them all with a touch of its passing
wing. But it has passed in the night this angel, when she only felt its
plumes, and heard its sweet unrecognised voice; and as yet she has
not seen the face of this new affection, nor blushes as she lifts her
own, frankly to all kindly eyes; yet with the greater zest she listens to
these girlish romances, and smiles, and asks questions—questions
which the blushing subject of the story does not always refuse to
answer; but just now the narrator has become rather loud, and there
is a burst of laughter which good Uncle Sandy would reprove from
his window, if he were not more seriously engaged.
Suddenly there falls a complete silence on the little group, broken
only after the first moment by an indistinct tittering of confusion and
bashfulness, as one by one they steal away, leaving Rose alone
under the plane tree—and the stranger advances at a singular pace,
which seems to be composed of two eager steps and one slow one,
towards her, as she stands, half-reluctant, with her head drooped
and the light stealing warmly over her cheek, waiting to receive him.
As he advances the colour rises on his forehead. It may be
because he is aware of some close scrutiny, but however that is,
Cuthbert Charteris, who can pass with the utmost coolness through
every corner of the Parliament House, and make his appearance
before the Lords who rule her Majesty’s Court of Session without a
vestige of shyness, grows very red and lets his glove fall, as he
advances to this audience. And the sympathetic Rose blushes too,
and hangs down her head, and gives her hand reluctantly, and
wishes she were anywhere but here, seeing any other person than
Mr. Charteris. Why? For after all, there is nothing formidable about
the Edinburgh advocate, and he has been her brother’s friend.
Martha’s hand again tightened on the old man’s arm; then it was
slowly withdrawn, and she sat still, looking at them earnestly—
looking at them in their fair youth, and with their fresh hopes round
them, like a saint’s encircling glory—so great a contrast to herself.
“Well, Martha, well,” said the old man, in a lighter tone, “well, my
woman—no doubt neither you nor me have anything to do with the
like of this; but it is good, like every ordinance of God. If Rosie, poor
thing, gets a good man, she’ll do well; and we need not be vexed for
that, Martha.”
“He is a gentleman, uncle, and not a rich one. They’ll want him to
have a rich wife,” said Martha.
“Be content—be content; one fear is over much to foster. We’ll have
no grief with Rosie,” said Uncle Sandy, cheerfully. “If he turns out
well, she’ll do well, Martha; but if he turns out ill, we must leave her
now to God’s good care and her ain judgment. And what could we
have better for her? But we need not leave them their lane, either. I
will go and see after the other bairns myself.”
So saying, the old man rose, and Martha lifted her work—but in a
few minutes it again dropped on her knee, and opening the window
she bent out, and suffered the pleasant air to bathe her forehead,
and smoothe out the wrinkles which care had engraven on it. “Take
care of them, take care of them!” said Martha, under her breath.
“God help me! I trust more in my own care than in His.”
“Ye’re aye idle—aye idle. Do they never come back to you in your
dreams the lees ye tell me, and the broken promises?” said Uncle
Sandy. “And Beatie, I had your faithful word that all that flower was to
be done before the morn.”
“Eh, but it was the gentleman,” said Beatie, with conscious guilt,
labouring at her muslin with great demonstration of industry.
“The gentleman! He came in himsel. He gave you no trouble,” said
the old man, shaking his head. “And you’ve been doing naething
either, Jessie Laing.”
“Eh! me! I’ve weeded a’ the strawberry beds, though there’s
naething on them yet but the blossom,” said the accused, in
discontent; “and Mary, and Maggie, and the rest of them, telling Miss
Rose about their lads a’ the time—and naebody blamed but me!”
“Miss Rose has gotten a lad o’ her ain—eh! look at the gentleman!”
said another of the sisterhood, in an audible whisper.
For Rose had been playing with a sprig of fragrant lilac, which just
now, as she started at sight of her uncle, fell upon the path at her
foot; and, with a deferential bend, which every girl who saw it took as
a personal reverence to herself, and valued accordingly, Mr.
Charteris stooped to pick up the fallen blossom, and by and bye
quite unobtrusively placed it in his breast.
Uncle Sandy lifted his book, and seated himself, casting a glance of
good pleasure towards the plane tree, from which Rose was now
approaching the door. Not a girl of all those workers who did not
observe intently, and with an interest hardly less than her own “lad”
received from her, every look and motion of “the gentleman.” Not one
of them who would not have intrigued in his behalf with native skill
and perseverance, had any of the stock obstacles of romance stood
in Cuthbert’s way. It was pleasant to see the shy, smiling, blushing
interest with which they regarded the stranger and his Lady Rose;
something resembling the instinctive, half-pathetic tenderness with
which women comfort a bride; but with more glee in it than that.
By and bye, when these young labourers were gone, and the
shadows were falling over the garden, where little Lettie and Uncle
Sandy’s maid scattered pleasant sounds and laughter through the
dim walks, as they watered Uncle Sandy’s dearest flowers, Cuthbert
Charteris unwillingly rose from the dim seat by the window, whence
he could just see Violet at her self-chosen task, and said irresolutely
that he must be gone. The window was open. They had been sitting
for some time silent, and the wind, which blew in playfully, making a
little riot now and then as it lighted unexpectedly upon the fluttering
pages of an open book, was sweet with the breath of many
glimmering hawthorns, and of that great old lilac bush—a garden
and inheritance in itself—which filled the eastern corner, and hid the
neighbouring house with its delicate leaves and blossoms. Opposite
to him, Cuthbert still saw the white hair of the old man, and
something of Martha’s figure withdrawn by his side; but out of a
pleasant darkness which his imagination filled very sweetly, had
come once or twice the voice of Rose. He could not see her, it had
grown so dark, nor could he do more than feel a little soft hand glide
into his, when he bade her good-night.
It had a singular charm, this darkness, and Cuthbert grasped the
hand firmly and closely before it drew itself away. Then he went out
into the soft summer night, with its sweet dews and sounds. A smile
was on his face, his very heart was wrapped in this same soft
fragrant gloom, and he went on unconsciously till he reached the
river, and stood there, looking down upon the gentle water, flowing
graciously, with a sweet ripple, under the pensive stars.
His hand upon his breast touched the lilac blossom. He drew it out
to look at it, and held it idly in his fingers, for his first thought was to
drop the fading flower into those pure cold waters, and let it float
away towards that sea which is the great symbol of all depths. But
Cuthbert’s second thought, more usual, if not more true, was to
restore the drooping blossom, and keep it, though it faded; and then,
making an effort to shake off the pleasant mystic darkness which hid
him from himself, Cuthbert Charteris roused his dreaming heart, and
asked what he did there.
What brought him here? The same question which Martha had put
to her uncle. No one saw Cuthbert blush; no one was witness to the
conscious smile which rose in spite of himself upon his lip. What
brought him here? In fact, the slightest possible piece of business,
which, at any other time, a letter might have managed; but, in truth—
what was it, Cuthbert?
And straightway the thoughts of Cuthbert Charteris plunged into a
long, discursive journey, calculating probabilities, prospects,
necessities; but through all wavered this conscious smile, and he felt
the warm flush on his face, and looked, as Rose had never looked
upon her passing angel, into the very eyes of the fairy guide who had
led him thither. The stars were dreaming in the sky, wrapped in soft
radiant mist, when he left the river-side. Like them, the young man’s-
heart was charmed. Not fervent enough for passion yet, nor
manstrong as it would be—charmed, fascinated, dreaming—a spell
of magic over him, was this new power—the earliest spring of a life
which should weave itself yet into the very strength of his.
CHAPTER VII.
pleasures of hope.
The evening sun shines into the drawing-room of Allenders—the
drawing-room newly completed and magnificent, through which
Harry Muir’s little wife goes merrily, laughing aloud as she pauses to
admire again and again those luxurious easy-chairs and sofas,
which it is almost impossible to believe are her own. It is a long room
occupying the whole breadth of the house, for Harry has taken
Cuthbert’s hint, and thrown down the partition which once made two
dim bed-chambers, where now is this pretty drawing-room.
From the western window you can see the long light stealing over
Bannockburn, tracing bright fines of softened green and yellow along
the wide strath, and laying down upon the swelling fields as it passes
away such a depth of dewy rest and shadow as never lay in any land
of dreams. And the hill-tops are dusty and mazed with the rays which
stream over them, a flood of golden streaks, falling out of the fight
like drooping hair; while nearer, at our very feet, as we stand by this
window, the burn below flashes out through the heavy alder boughs,
in such sweet triumph over its crowning sunbeam, that you
unconsciously smile in answer to its smiling, as you would to any
other childish joy.
From the other window you can look out upon Demeyet, somewhat
sullenly receiving the radiance of the sunset. He, stout rebel, loves
better the young morning, whose earliest glance is over his head,
before her eyelids are fully opened. How she glances up playfully
behind him, how she shrinks under his great shoulder, you will see,
when you see the sun rise upon the links of Forth. But Demeyet, like
many another, does not know when fortune is kindest to him, nor
ever guesses that he himself, with those royal purple tints upon his
robed shoulders, and the flitting shades which cover his brow, like
the waving of a plume, shows his great form to better advantage
now, than when the faint morning red, and the rising light behind,
darken him with his own shadow. Wherefore Demeyet receives the
sunlight sullenly, and glooms upon merry Agnes Muir at the window
of Allenders’ drawing-room, till she can almost fancy that he lifts a
shadowy arm, and clenches a visionary hand to shake it at her
threateningly with defiance and disdain.
A silver tea-service, engraven with the Allenders’ crest, and china
the most delicate that Agnes ever saw, glitter on the table, which is
covered besides with every rare species of “tea-bread,” known to the
ingenious bakers of Stirling. And now Agnes glides round and round
the table, endeavouring to recollect some one thing omitted, but
cannot find any excuse for ringing the bell and summoning one of
her hand-maidens to get another survey of the tout ensemble, which
dazzles the eyes of the little wife. Harry has gone to Stirling to meet
and bring home his sisters; and Uncle Sandy, their escort and
guardian, is with them for a visit; and so is poor little Katie Calder,
the oppressed attendant of Miss Jean. It is true that Agnes is very
affectionate and very grateful—that, herself motherless, she clings to
Martha, and would immediately succumb in any strait to the stronger
mind, and character, and will of the eldest member of their little
household; but withal, Agnes is mortal, and it is impossible to deny
that there is quite a new and delightful pleasure to her in feeling
herself, and in having others feel, that it is her house to which the
sisters are coming home—that she is the head of the family, the
house-mother, and that all the glories of this grandest of palaces are
her own.
Now a faint rumbling of distant carriage-wheels strikes on the
excited ear of Agnes, but no carriage is visible from the windows—so
she runs impatiently up some flights of narrow winding stairs, and
emerges, out of breath, upon the gallery, which conducts to the little
turret of Allenders. This gallery is very small—three people standing
in it would make quite a little crowd; but then it commands a far-off
view of the Forth, beyond Alloa in one direction, and of Stirling’s
crowned rock, and the Highland hills, and what is still more important
at this moment, of the Stirling road, on the other.
And yonder, along the white line of the Stirling road, seen at present
only in a glimpse through the trees, comes that pretty open carriage,
the price of which Harry is afraid to think of, his latest purchase, with
its strong bay horse and its smart groom driver, beside whom Harry
himself, still wise enough to acknowledge that he cannot drive, sits
leaning back, to point out triumphantly to the crowded company
behind him the first glimpse of their new house. Martha and Uncle
Sandy, Rose and the two children, fill the coach almost to over-
brimming; and though they are all dusty and hot, there are bright
looks on every face of them. But Agnes does not pause to look at
their faces, but flies down stairs, nearly tripping herself with the wide
folds of her muslin gown, to throw the door hospitably open, and
stand herself, dignified like a matron and head of a family, on the
threshold, to receive the strangers.
At the gate, the innocent Dragon of Allenders twirls his rusty hat
feebly on a stick, and laughs to himself with his slow chuckle as he
leans upon the opened gate; and half in curiosity, half because the
housemaid was once in Sir John Dunlop’s, and has very proper
notions of what is due to the “family,” Agnes finds both her servants
standing behind her in the hall. The little wife holds her head high,
and overflows with dignity and innocent stateliness, all the while
feeling an almost irresistible inclination to relieve herself with a burst
of incredulous, wondering laughter; for how she ever came to be a
great lady, Agnes cannot comprehend.
Now, Lettie, jump! Be first out of the grand carriage—first upon the
bright green lawn of Allenders. See, yonder are soft-voiced doves
upon the turret; and the spear-head, no longer tarnished, throws
gleams about it in the sunshine upon those twinkling, tremulous
aspen leaves; and listen here to this child’s tongue singing, calling to
you, though the language is not yours—the burn, Lettie! and this
brown foliage is the fragrant walnut; and past the grey walls and that
dim library window is a broad gleam of silver, all fretted and broken
by twining boughs and foliage, for that is the river—the grand Forth
—and this is fairy land!
“Oh, Martha, Martha!—Rose!—Uncle!” cried Agnes, running
forward to the carriage-door; but as Martha alighted, and took both
her hands, the young house-mother forgot her dignity, and instead of
the pretty speech she had been meditating, only exclaimed again:
“Oh, Martha, Martha!” and burst into a fit of tears.
Laughing, sobbing, smiling, Agnes led them up-stairs, and hurried
them through all the rooms. A pretty apartment, looking to the river,
had been chosen for Martha and Rose, while a smaller one within it
was for the children. They were all perfectly and carefully fitted up—
alas! for Harry’s nine hundred pounds.
“Bairns, I will ask a blessing,” said Uncle Sandy, as they gathered
round the tea-table.
There was an instant hush, and Rose shrouded little Harry’s head
with her hand, and pressed him closer to her side, to still even the
child into reverent silence. She was seated close by the old man,
and he, too, raised one hand to shade his reverent forehead, and
solemnly lifted the other.
“Lord, a blessing on these offered mercies, a blessing on this roof-
tree, upon our meeting and our sundering, and upon these Thy
bairns, fatherless and motherless, whom Thou hast led hitherto, and
brought pitifully unto this day. Give them out of the ark of Thy
covenant, comfort them with strength, and succour from all evil, for
the Lord’s sake. Amen.”
There was a momentary solemn pause, after the voice ceased—
and Rose bent down over the child to hide her face; and Agnes, with
the tears still in her eyes, looked wistfully at the old man; and Harry
cast down his, and laid his hand softly on Martha’s hand. No one
said there were fears and hopes—intensest hopes and fears in this
new beginning—nor that its brightness trembled with a solemn
peradventure; but at this moment, all had a consciousness of putting
themselves and their fate into the hand of God, and of waiting for
what He should bring out of those unknown years. “I cannot tell—
God knows what is to come,” said Martha’s heart, as it yearned
within her over them all; and there came to each a strange humility
and trust. God knows! one can look calmly into a future which, step
by step, is known to our pitiful, great Father. Day by day—hour by
hour—they must each of them come to us out of the heavens, full
and rounded with the daily tribulation, the daily gladness which is
appointed to their lot. But God knows now the way which we shall
learn by single footsteps—knows and appoints it for us out of His
great love—God knows—it is very well.
CHAPTER VIII.
rogers.
“Eh, Violet! there’s twa men-servants, and twa maids!” said little
Katie Calder.
Katie was short and stout, with a plump, good-humoured face, and
wealth of long fair hair, and a bright-printed frock, bought for her by
Uncle Sandy himself, to replace the faded liveries of Miss Jean.
Katie had no turn for literature or poetry, like her little kinswoman; but
to make up for that, she was stout-hearted and adventurous,
redoubtable in winter slides and summer rambles, and with as
honest and “aefauld” a child’s heart as ever looked through blue
eyes. Miss Jean Calder and her penurious oppression had subdued
Katie, but they had not crushed her; for Katie was not given to
solitary thoughts or plaintive resignation. So instead of standing
shyly by, as Violet might have done, and looking on with a longing
wish to join the plays of happier children, Katie made bold dashes
among them, content rather to pay for her play by a good fit of
crying, when summoned in to the invariable scold, than to want
altogether the wholesome “fun” which was the child’s natural breath.
So now, being prepared by a few days’ freedom in Uncle Sandy’s
house at Ayr, for the liberty and kindliness, though scarcely for the
grandeur of Allenders, Katie’s happy spirit had entirely thrown off the
fear and bondage of Miss Jean. She was sitting on a low stool half-
dressed, plaiting the long hair which streamed over her plump
shoulders, and looking with great admiration at the new chintz frock
carefully spread out upon a chair, which she had worn for the first
time yesterday.
“Eh, Katie! if you only saw how the sun’s rising behind yon muckle
hill!” answered Violet from the window.
“And you never saw such a fine kitchen,” pursued Katie, “a’ the
walls glittering with things, and as big as folk could dance in; and
such a room with books down the stair. Did you think there was as
mony in the world, Lettie?”
“But they’re no for reading,” said Violet disconsolately, “for I tried
them last night; and I would rather have Mr. Sim’s library in the
Cowcaddens.”
“Were there stories in it? Eh, Violet, do you think there’s ony fairy
tales down the stair? for I like them,” said Katie Calder; “but if I put
on my new frock the day, it’ll no be clean on Sabbath to gang to the
kirk.”
“There’s Rose down in the garden—and there’s the old man that
Harry calls Dragon,” cried Violet. “Come, Katie, and see the Forth
and our boat.”
“It’s no so bonnie as our ain water at hame, and there’s nae brigs,”
said Katie, as she donned her new frock, and anxiously examined it,
to see whether yesterday’s journey had left any trace upon its bright
folds; for Katie was a thrifty little woman, and knew that she had no
other dress worthy of Allenders.
It was still very early. Rose had newly left the house, and now stood
alone under the great shadow of the walnut tree, looking up at the
windows, beyond which the greater part of the household were still
asleep. She had left Martha in a deep, quiet, dreamless slumber
which did not begin till the sky was reddening over Demeyet; and
Rose who had just been congratulating herself on having a free
unoccupied hour to think, stood now endeavouring, with some
confusion, to recollect what it was she wanted to think about. Her
mind was in a tumult of sweet morning fancies, and the something
on which she had resolved to meditate, eluded her, with many a trick
and wile, like a playful child. A slight wavering blush came over her
face, as now and then she seemed to catch a glimpse of it for a
moment; but immediately it was lost again among the thick-coming
fancies of her stirred and wakening mind; yet strangely enough,
Rose did not pass the library window, nor seek the mall by the water-
side. Not very long ago, nothing could have interested her more than
the river and the hills beyond; now she only threw herself down on
the lawn beneath the walnut tree, and leaning her head on her hand,
played with the grass on which her eyes were bent, and mused and
pondered with a downcast face. Sometimes indeed, her eyes were
closed, and even when she opened them the dreamer saw nothing
of Allenders. No; for she was secretly making pictures which could
not bear the eye of day, much less the inspection of brother or sister;
remembering, with such strange tenacity of recollection, what was
done and what was said, on yonder May evening in the garden at
Ayr, and in the gloom of the little parlour, and unconsciously creating
other scenes like that, in which the same chief actor bore the hero’s
part.
Rose! Rose! you would blush and start like guilt, did any home
voice at this moment call your name; but the spell of this dreaming
clings to you like slumber, and you can no more shake it off, than
you could the sweet deep sleep which last night surprised you
against your will, and changed those waking musings into the
fantastic visions of the night; and your eyes grow heavy, Rose, while
your heart wanders in this maze, and a soft uncertainty steals over
your fair pictures, though with a sudden start, half of displeasure, you
hear the steps of the children hastening to join you, and give up your
maiden meditations with a sigh.
Behind the walnut tree, the poor old Dragon feebly bends over the
flower-beds, plucking up here and there, with an effort, a solitary
weed, but oftenest looking idly towards Rose, whom he would fain
go and speak to, were not her preoccupation so evident. The great
walnut waves its large fragrant leaves in the soft morning air
between them, and the sun burns in the gilded spear on the turret,
and the broad light clothes the whole country like a garment.
Strongly contrasted in this framework of summer life about them, are
the two human creatures who complete the picture. The girl lingering
on the threshold of a fair life unknown to her, and peopling all its fairy
world with scenes which thrill her to a half-conscious joy; the old man
in the torpor of great age, vacantly admiring her fresh youth, and with
a strange, dim curiosity about her, who she is, and what she would
say if he addressed her. To him a long life has passed like a dream,
and appears in a mist to his memory, as in a mist it appears to her
imagination; but the time is long past when anything could find out
the old faint beating heart of Adam Comrie, to thrill it with emotion.
His curiosities, his likings, his thoughts, have all become vague as a
child’s; but they lie on the surface, and never move him, as a child’s
fancies do.
“See how the old man looks at Rose,” whispered Katie Calder; “but
she doesna see him yet; and, Violet, look at her. She’s bonnie.”
“But what way is she sitting there?” said Violet, wonderingly, “when
she might be at the water-side. She’s thinking about Harry; but what
needs folk think about Harry now? Harry is in his bed and sleeping,
Rose; but, oh! I see—you were not thinking about him after all.”
Rose started with a vivid blush. No, indeed, she had not been
thinking of Harry; it sounded like an accusation.
“And you’ll be yon birkie’s Lady Rose?” said the Dragon, coming
forward. “Aweel I wadna say but he thought ye bonnier than my
white bush; but they didna howk up the rose either; that’s ae comfort
—though nae thanks to him, nor to this lad, Mr. Hairy, that took his
counsel. What do they ca’ this little bairn?”
“My name’s Violet,” said Lettie, with dignity.
“There was a Miss Violet in the last family; but she would have
made six o’ that bit creature,” said the old servant. “What way are ye
a’ sae wee?”
“Eh! Lettie’s a head higher than me!” exclaimed Katie Calder in
amazement.
“Are you gaun to be married upon yon birkie now, if ane might
speer?” asked the feeble Dragon. “I’ve lived about this house sixty
year, but there hasna been a wedding a’ that time; and now how I’m
to do wi’ young wives and weans I canna tell. The last Allenders had
a wife ance, folk say, but I never mind of her. He was ninety year
auld when he died, and lived a widow three score years and five. I’m
eighty mysel, and I never was married. It’s aye best to get ower the
like o’ that when folk’s young; but you’re just a lassie yet; you should
wait awhile, and be sicker; and yon birkie has nae reverence for the
constitution. I’m an awfu’ guid hand for judging a man, and I ken as
muckle by what he said about the windows.”
“Eh, Rose, is’t Mr. Charteris that’s the birkie?” cried Violet, with
extreme interest.
But Rose had risen from the grass, and now leaned upon the
walnut tree, vainly trying to look serious and indifferent. This face
which had been eluding her dreams so long, looked in gravely now
upon her heart; and Rose trembled and blushed, and could not
speak, but had a strong inclination to run away somewhere under
cover of the leaves, and weep a few tears out of her dazzled eyes,
and soothe her heart into calmer beating. The old man chuckled
once more in childish exultation.
“I’ll no tell—ye may trust me—and if ye’ll come in ower, I’ll let you
see the white rose bush that garred yon birkie name ye to me.
Whaur are ye for, you little anes? is’t the boat the bairns want? I’m
saying!—I’ll no hae ony o’ you drowning yoursels in the water; and I
gie you fair warning, if you should fa’ in twenty times in a day, I’m no
gaun to risk life and limb getting ye out again—it doesna stand to
reason that a wean’s life should be as valuable to this witless world
as the life of an aged man. And I’ve had muckle experience in my
day—muckle experience, Miss Rose; and aye glad to communicate,
as the Apostle bids, and ready to give counsel, wi’ nae mair pride
than if I had seen but ae score o’ years instead of four. It’s a great
age.”
“And do they call you Dragon,” asked Violet, shyly.
“That’s what they ca’ me; for I’ve lang keepit Allenders, and been a
carefu’ man of a’ in it, from the master himsel to the berry bushes;
but my right name is Edom Comrie, if onybody likes to be so civil as
ca’ me that. I’m saying, wee Missie, do ye think I could carry ye? but
I’m no so strong as I was forty year ago.”
“You could carry little Harry; but I can rin, and so can Katie Calder,”
said Violet.
“Wha’s Katie Calder?”
“It’s me,” answered the little stranger; “and I’m Lettie Muir’s third
cousin; and I’m to stay at Allenders, and no to go back to Miss Jean
any more.”
“Weel, ye maun baith be guid bairns. I like guid bairns mysel,” said
the old man; “and ye can just come to me when ye want a piece
scone or a wheen berries, and there’s nae fears o’ ye; and I’ll aye gie
them an advice, Miss Rose, and mind them of their duty. Ye needna
be feared but I’ll do grand with the bairns.”
“Do you live in the house?” asked Rose, a little timidly, for she was
somewhat alarmed at the second sight of the poor old Dragon.
“That minds me ye havena seen my room,” said Dragon, briskly.
“Come your ways round—aye, I just live in Allenders—and gie me a
haud o’ your hands, bairns, and Miss Rose will come after us, and
ye’ll get a sight of my house.”
So the soft warm childish hands glided into the withered fingers of
the old man, and Rose followed, passing by the luxuriant white rose
bush, now blooming in the full flush of its snowy flowers under the
new window of the dining-room, into a little court-yard behind where
was the stable and byre, and where Mysie, the Dragon’s grand-
niece, was just then milking the cow. This great temptation, Violet
and Katie withstood womanfully, and passing the milk-pail and the
active hands which filled it, with an effort, looked round somewhat
impatiently for the Dragon’s den.
“Ye maun come up here,” said the old man, “ane at a time—ane at
a time—and if ye’re light-headed, take a grip o’ the wa’, for folk are
whiles dizzy on an outside stair; and now here you see I have like a
wee house all to mysel.”
The “outside stair” was very narrow and much worn; it was evident
it had undergone no repair in all Harry’s labours, and Rose was fain
to grasp herself at a withered branch of ivy which still clung to the
wall, though life and sap had long departed from it, to secure her
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com