0% found this document useful (0 votes)
18 views67 pages

(Ebook) Advanced Programming Using Visual Basic 2008 by Julia Case Bradley, Anita Millspaugh ISBN 9780073517223, 0073517224

The document provides information about the ebook 'Advanced Programming Using Visual Basic 2008' by Julia Case Bradley and Anita Millspaugh, including its ISBN details, download link, and a brief overview of its content. It highlights the book's focus on advanced programming concepts, including database applications and web development using Visual Basic 2008. Additionally, it lists other related ebooks available for download on the same platform.

Uploaded by

maltzlaitho4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views67 pages

(Ebook) Advanced Programming Using Visual Basic 2008 by Julia Case Bradley, Anita Millspaugh ISBN 9780073517223, 0073517224

The document provides information about the ebook 'Advanced Programming Using Visual Basic 2008' by Julia Case Bradley and Anita Millspaugh, including its ISBN details, download link, and a brief overview of its content. It highlights the book's focus on advanced programming concepts, including database applications and web development using Visual Basic 2008. Additionally, it lists other related ebooks available for download on the same platform.

Uploaded by

maltzlaitho4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

Visit https://ebooknice.

com to download the full version and


explore more ebooks

(Ebook) Advanced Programming Using Visual Basic 2008


by Julia Case Bradley, Anita Millspaugh ISBN
9780073517223, 0073517224

_____ Click the link below to download _____


https://ebooknice.com/product/advanced-programming-
using-visual-basic-2008-1995366

Explore and download more ebooks at ebooknice.com


Here are some recommended products that might interest you.
You can download now and explore!

(Ebook) Programming in Visual Basic 2008, 7th Edition by


Julia Case Bradley, Anita C. Millspaugh ISBN
9780073517209, 0073517208
https://ebooknice.com/product/programming-in-visual-basic-2008-7th-
edition-2417356

ebooknice.com

(Ebook) Programming in Visual C# 2008 by Julia Case


Bradley, Anita Millspaugh ISBN 9780073517216, 0073517216

https://ebooknice.com/product/programming-in-visual-c-2008-10966170

ebooknice.com

(Ebook) Programming in Visual C# 2008 by Julia Case


Bradley, Anita Millspaugh ISBN 9780073517216,
9780077398934, 0073517216, 0077398939
https://ebooknice.com/product/programming-in-visual-c-2008-1884256

ebooknice.com

(Ebook) Biota Grow 2C gather 2C cook by Loucas, Jason;


Viles, James ISBN 9781459699816, 9781743365571,
9781925268492, 1459699815, 1743365578, 1925268497
https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374

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

(Ebook) Matematik 5000+ Kurs 2c Lärobok by Lena


Alfredsson, Hans Heikne, Sanna Bodemyr ISBN 9789127456600,
9127456609
https://ebooknice.com/product/matematik-5000-kurs-2c-larobok-23848312

ebooknice.com

(Ebook) Microsoft Visual Basic 2008 Express Programming


for the Absolute Beginner by Ford, Jr. Jerry Lee ISBN
9781598639001, 1598639005
https://ebooknice.com/product/microsoft-visual-basic-2008-express-
programming-for-the-absolute-beginner-55132374

ebooknice.com

(Ebook) SAT II Success MATH 1C and 2C 2002 (Peterson's SAT


II Success) by Peterson's ISBN 9780768906677, 0768906679

https://ebooknice.com/product/sat-ii-success-
math-1c-and-2c-2002-peterson-s-sat-ii-success-1722018

ebooknice.com

(Ebook) Programming Visual Basic 2008: Build .NET 3.5


Applications with Microsoft's RAD Tool for Business by Tim
Patrick ISBN 9780596518431, 0596518439
https://ebooknice.com/product/programming-visual-basic-2008-build-
net-3-5-applications-with-microsoft-s-rad-tool-for-business-1021742

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

Advanced Programming Using Visual


Basic 2008
2008 Edition

Bradley−Millspaugh

McGraw-Hill
=>?
McGraw−Hill Primis

ISBN−10: 0−39−012228−9
ISBN−13: 978−0−39−012228−5

Text:

Advanced Programming Using Visual Basic


2008
Bradley−Millspaugh
This book was printed on recycled paper.

Computer and Information Technology

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.

This McGraw−Hill Primis text may include materials submitted to


McGraw−Hill for publication by the instructor of this course. The
instructor is solely responsible for the editorial content of such
materials.

111 COMPGEN ISBN−10: 0−39−012228−9 ISBN−13: 978−0−39−012228−5


Computer
and
Information
Technology

Contents

Bradley−Millspaugh • Advanced Programming Using Visual Basic 2008

Front Matter 1
Preface 1
To the Student 9

1. Visual Studio and the .NET Framework 11


Text 11

2. Building Multitier Programs with Classes 59


Text 59

3. Windows Database Applications 115


Text 115

4. Windows Database Using Related Tables 159


Text 159

5. Windows Database Updates 197


Text 197

6. Services 259
Text 259

7. Web Applications 285


Text 285

8. Web Database Applications 361


Text 361

iii
9. Reports 413
Text 413

10. Collections 441


Text 441

11. User Controls 475


Text 475

12. Help Files 501


Text 501

13. Additional Topics in Visual Basic 517


Text 517

Back Matter 551


Appendix A: Answers to Feedback Questions 551
Appendix B: Review of Introductory VB Concepts 563
Appendix C: Deployment 609
Appendix D: Tips and Shortcuts for Mastering the Environment 617
Glossary 635
Index 644

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.

About This Text


This textbook is intended for use in an advanced programming course, which
assumes completion of an introductory course. The text incorporates the basic
concepts of programming, problem solving, programming logic, as well as the
design techniques of an object-oriented language.
Appendix B contains a summary of topics normally covered in an introduc-
tory text, as a tool for review.

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.

Changes in This Edition


This edition presents material in a sequence designed for teaching students
and does not attempt to cover all topics for certification exams.
iii
2 Bradley−Millspaugh: Front Matter Preface © The McGraw−Hill
Advanced Programming Companies, 2010
Using Visual Basic 2008

FEATURES OF THIS TEXT


With StoresBindingSource
Hands-On Programming Examples C H.EndEdit()
A P T E R
.AddNew()
These complete programming exercises guide
students through the process of planning,
writing, and executing Visual Basic programs.
4 End With
AddingBoolean = True
SetComboBoxBinding()
Stor_nameComboBox.Focus()
SetControlsReadOnly(False)

Your Hands-On Programming Example Windows Database


SetButtonsForEdit()
If Stor_nameComboBox.SelectedIndex <>
' Save the index of the new record
Create a multiple-tier project to obtain data from the employee table in the
Pubs database using a stored procedure. Use an ORDER BY clause in the stored
procedure to sort the data in order by last name. Display the full employee
names (last name, first name, and middle initial) in alphabetic order in a combo
Using Related Tables
Else
PreviousSelectedIndex = Stor_nameC
box. Do not display the first and last name fields other than in the combo box.
Show the remaining fields in text boxes for the selected record, with meaning- PreviousSelectedIndex = 0
ful identifying labels. Do not include a navigation toolbar. Include a File / Exit
menu item to terminate the program. End If
Planning the Project at the completion of this chapter, you will be able to . . .
Sketch a form (Figure 3.30) that your users sign off as meeting their needs.
1. Explain the types of table relationships.
Figure 3.30 2. Display master/detail records.
A planning sketch for the 3. Display a field from a second table using a lookup.
File hands-on programming
Name: FullNameComboBox example. 4. Create a search using a parameterized query and write a filter to retrieve specific data.
Employee ID: Emp_idTextBox
5. Assign data values to unbound controls.
Job ID: Job_idTextBox
Job Level: Job_lvlTextBox 6. Retrieve and display the parent row for a selected child row.

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

Object Property Setting

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 Security Issue


Case Studies provide continuing-theme Any coverage that discusses security
exercises that may be used throughout concerns is pointed out with a Security
the course. Issue icon.

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.

Online Learning Center


Visit the Advanced Programming Using Visual Basic 2008 Web site at
http://www.mhhe.com/AdvVB2008/ for instructor and student resources.
4 Bradley−Millspaugh: Front Matter Preface © The McGraw−Hill
Advanced Programming Companies, 2010
Using Visual Basic 2008

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>.

Major Revisions and Additional Topics in This Edition


With the exception of small, concept-demonstrating programs, all programs
are written as multitier applications. WCF Services are covered prior to Web
applications, and the middle-tier components are written as services.
The text covers the new features of Visual Studio 2008 and many useful
existing features, including
• Windows Presentation Foundation (WPF).
• Windows Communication Foundation (WCF).
• Language-Integrated Queries (LINQ).
• Creation of DataContext objects from database tables for use with LINQ.
• AJAX.
• Cascading style sheets.
• Adding of validation code to the DataSet object.
• Crystal Reports using local databases for both Windows and Web
applications.
• Partial classes.
• The singleton design pattern for a class that should be instantiated only
once.
• Validation of user input using TryParse.
• ClickOnce deployment.
• Generics and generic collections.
• Master pages.
• SQL Server Express, which provides the advantage of local database files
for development and testing.
• TableAdapter, BindingSource, TableAdapterManager (new), and Binding-
Navigator objects.
• Table lookups for populating a combo box from a related table.
• Use of properties and methods of the BindingSource to filter, navigate, and
update database tables.
Bradley−Millspaugh: Front Matter Preface © The McGraw−Hill 5
Advanced Programming Companies, 2010
Using Visual Basic 2008

P R E F A C E vii

• Use of named table relationships.


• Use of related tables in a Web service.
• The Login controls for Web applications.
• Display and updating of data using the Web DataSource objects and data
components: GridView, DetailsView, and FormView.
• The built-in Web server, which allows development of Web applications
without the necessity of running IIS. This feature also allows development
on the home editions of Windows XP and Vista, and does not require
administrative rights for all Web development.
• Smart Device applications, including the new device emulators.
• Use of My.Application for changing culture settings.
• The BackgroundWorker component for executing more than one thread.
New features of the Visual Studio IDE that are covered in the text include
• The Object Relational O/R Designer.
• XAML split windows.
• The TableAdapterManager.
• CSS Properties window, Manage Styles window, and Apply Styles window.

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

Chapter 4, “Windows Database Using Related Tables,” explores


the types of table relationships and covers the display of related tables on
Windows forms. The chapter discusses how to retrieve and display the
parent row for a selected child row and also an array of child rows for a
selected parent row.
Chapter 5, “Windows Database Updates,” performs updates on
data in a grid, in bound controls on a form, and in unbound controls.
Updating related tables also is covered. Both a combo box selection and
the form’s binding navigator are used to navigate records.
Chapter 6, “Services,” discusses the concepts of WCF Services.
Examples for services include calculations and database access.
Chapter 7, “Web Applications,” discusses the concepts of Web-
based applications and the files that make up a Web project. Hyperlinks
and link buttons allow navigation from one Web page to another while
maintaining the state (data values). The Validator controls test user
input. Master pages and cascading style sheets assist in designing the
layout for the Web site.
Chapter 8, “Web Database Applications,” covers the techniques
for accessing data using data source controls. The chapter discusses
displaying data from related tables and updating databases from a Web
page. Multitier development uses a service for database access and
updates.
Chapter 9, “Reports,” uses advanced reporting features, such as
numeric functions, grouping, sorting, and special fields. Both Windows
applications and Web applications are covered.
Chapter 10, “Collections,” discusses types of collections including
stacks, queues, dictionaries, hash tables, sorted lists, and array lists. The
chapter demonstrates adding objects to the Items collection of a list box.
The chapter also demonstrates implementing the generics and generic
collections.
Chapter 11, “User Controls,” creates Windows user controls and Web
controls. The techniques for raising an event and writing code in the form
to handle the event are discussed.
Chapter 12, “Help Files,” creates the necessary files to set up HTML
Help and uses HTML Help Workshop to create a Help file.
Chapter 13, “Additional Topics in Visual Basic,” demonstrates how
to develop applications for mobile devices, how to create interfaces with
WPF and use the WPF controls in a Windows Form Application, how to
localize an application, and how to use the BackgroundWorker class to
run processes in a separate thread. LINQ is introduced with arrays, LINQ
to SQL, and LINQ to XML.
The appendices offer important additional material. Appendix A
holds the answers to all Feedback questions. Appendix B is an
extensive review of VB topics generally covered in an introductory
course. Appendix C covers deployment using ClickOnce and
Appendix D contains many helpful tips and shortcuts for mastering
the Visual Studio environment.
Bradley−Millspaugh: Front Matter Preface © The McGraw−Hill 7
Advanced Programming Companies, 2010
Using Visual Basic 2008

P R E F A C E ix

Resources for Instructors


The Online Learning Center (OLC) available at www.mhhe.com/
AdvVB2008 contains the following supplemental materials:
Instructor’s Manual
• Objectives with built-in summaries for each chapter.
• Teaching suggestions.
• Answers to the Review Questions from the end-of-chapter material.
• Chapter topics covered in the Programming Exercises.
Testbank offers over 500 questions covering key terms and concepts found
in each chapter. The test questions appear in the form of true-false and
multiple-choice questions. Text page references have been provided for all
questions, including level-of-difficulty rating. A computerized version of
the testbank in EZTest is also available.
PowerPoint Presentation, authored by Brenda Nielsen of Mesa
Community College–Red Mountain, follows the outline of the Instructor’s
Manual and gives instructors a resource for presenting the text material
to a classroom.
Text figures are available electronically for use in presentations,
transparencies, or handouts. These include all the illustrations,
screenshots, and tables featured throughout the book.
An Online Learning Center (OLC) is also available for students and
instructors. The OLC can be found at www.mhhe.com/AdvVB2008 and
offers a wide variety of learning opportunities for students, including
additional case studies, self-quizzes, and downloadable data files.
Instructors also will find the OLC a useful resource.

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)

Visual Studio and the


SetButtonsForEdit()
If Stor_nameComboBox.SelectedIndex <> -1
' Save the index of the new record fo
.NET Framework
Else
PreviousSelectedIndex = Stor_nameComb

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.

3. Understand what happens at compile time.

4. Set and display data from the application’s assembly attributes.

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

2 A D VA N C E D P R O G R A M M I N G U S I N G V I S U A L B A S I C 2 0 0 8 Visual Studio and the .NET Framework

Microsoft revolutionized the programming for Windows applications and be-


came a bigger player in the development of Web applications with the introduc-
tion of the .NET Framework and Visual Studio (VS). These products introduced
significant changes into program development for Visual Basic (VB). Not only
did .NET bring true object orientation to the language; it also provided great
advances in the ease of developing projects for cross-platform compatibility.
The two major parts of .NET are the Microsoft .NET Framework and the
Visual Studio integrated development environment (IDE). The IDE is used to
develop programs and the Framework runs the programs.

The .NET Framework


The .NET Framework provides a platform for developing and running applica-
tions and Windows Communications Foundation (WCF) services written in mul-
tiple languages on multiple platforms. The Framework is composed of the common
language runtime, class libraries, and ASP.NET—a component-based version of
active server pages (ASP).

The Common Language Runtime


The common language runtime (CLR) is an environment that manages
execution of code. It provides services for tasks such as integrating components
developed in different languages, handling errors across languages, providing
security, and managing the storage and destruction of objects.
Any code that is compiled to run in the CLR is called managed code.
The managed code automatically contains metadata, which means data that
describe data. A common language runtime portable executable (PE) file con-
tains the metadata along with the code. The metadata include data types, mem-
bers, references, and information needed to load classes and to call methods
from a class.
The CLR also manages memory used by .NET applications. Objects that
are no longer being used are automatically removed from memory by the gar-
bage collector component of the CLR. When you allow the runtime to handle
the garbage collection of objects, the data are referred to as managed data.
Although you can manage application memory yourself, it is usually better and
more secure to let the runtime handle it.
Your code can be integrated with classes and methods of managed code
written in other programming languages. The CLR has standards for data types
that allow you to pass an instance of one of your classes to a method created in
a different language. Although we will not be doing any cross-language pro-
gramming in this text, you should be aware of this powerful feature. Note that it
is also possible to integrate methods and components created in unmanaged
code, but beware of calling unmanaged code such as C++ functions or COM
components as they may introduce security risks to your program.

The Class Library


All of the .NET classes and interfaces are stored in a library known as the
.NET Framework class library. The library is organized into sections or
groups known as namespaces. You should be familiar with some of the common
Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill 13
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008

C H A P T E R 1 3

namespaces such as System and System.Drawing. Each namespace contains


classes, structures, enumerations, delegates, and/or interfaces that you can use
in your programs. Table 1.1 shows some of the namespaces in the .NET Frame-
work class library.

Selected Namespaces from the .NET Class Library Ta b l e 1.1


Namespace Contents

System Base classes and fundamental classes for data types,


events, and event handlers.

System.Collections Definitions of collections of objects such as lists,


queues, and dictionaries.

System.Data ADO.NET architecture used to access databases.

System.Drawing GDI+ graphics for drawing on the screen, printer, or


any other graphic device.

System.IO Types for reading and writing data streams and files.

System.Linq Supports queries for Language-Integerated Queries

System.Security Base classes for permissions.

System.Threading Classes for multithreaded programming.

System.Web.Services Classes for building and using Web Services.

System.Windows.Forms Classes for creating graphical components for programs


that execute in the Windows operating environment.

System.XML Support for XML processing. XML is a standard for


transferring data.

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:

Dim AnyName As SomeType

Value Types versus Reference Types


When you declare a variable, it may be considered a value type or a refer-
ence type. The difference between the two determines how the runtime will
14 Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008

4 A D VA N C E D P R O G R A M M I N G U S I N G V I S U A L B A S I C 2 0 0 8 Visual Studio and the .NET Framework

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.

' Value types.


Dim FirstValueInteger As Integer = 10
Dim SecondValueInteger As Integer
SecondValueInteger = FirstValueInteger
FirstValueInteger = 5
' What is the value in each of the variables?
Debug.WriteLine("FirstValueInteger = " & FirstValueInteger.ToString() & _
"; SecondValueInteger = " & SecondValueInteger.ToString())

' Reference types.


Dim FirstForm As New Form1()
Dim SecondForm As Form1
SecondForm = FirstForm ' Assign reference for first form to second form.
SecondForm.Text = "Second Form Caption"
FirstForm.Text = "New Caption for First Form"
' What is the Text property of FirstForm? Of SecondForm?
Debug.WriteLine("FirstForm = " & FirstForm.Text & _
"; SecondForm = " & SecondForm.Text)

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.

Compiling to Intermediate Language


The program code that you write is referred to as source code. The compiler
translates your code into Microsoft intermediate language (MSIL) or
Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill 15
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008

C H A P T E R 1 5

sometimes referred to as just IL. MSIL is a platform-independent set of in-


structions that is combined with the metadata to form a file called a portable
executable (PE) file, which has an .exe or .dll extension. When your program
runs, the MSIL is converted to the native code of the specific machine only
as it is needed, using a just-in-time (JIT) compiler, which is part of the CLR
(Figure 1.1).
Figure 1.1

The steps in compiling and


CLS PE Native code
Managed executing a program using the
compliant JIT for target
source .NET CLR.
language MSIL and compiler computer
code
compiler Metadata

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.

The References Collection


A reference object is used to connect a Visual Basic project to external com-
ponents. The two types of reference objects are assemblies and COM objects.
A reference to another project is an assembly reference and is called a project-
to-project reference. COM objects are components written in versions of VB
prior to .NET, or other non-CLS-compliant languages.
16 Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008

6 A D VA N C E D P R O G R A M M I N G U S I N G V I S U A L B A S I C 2 0 0 8 Visual Studio and the .NET Framework

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

You can save or discard a


temporary project.

Setting Environment Options


The Options dialog box provides several useful features. Select Tools / Options
and select the check box for Show all settings (Figure 1.3). By default, for a VB
developer profile, the Options dialog box shows a limited subset of the options
you can set. You may want to spend some time exploring the various options.
Figure 1.3

Select Show all settings to see


all of the options that you can
view and change in the Options
dialog box.

Select Show all settings

Selecting the Visual Basic Development Settings


When you install VS 2008, you are prompted to specify the profile for the
default settings. This text is based on choosing the Visual Basic Development
settings. If you are sharing a computer with someone developing in a different
language, or the proper settings were not chosen, you may need to reset the
defaults. Choose Tools / Import and Export Settings. In the wizard, specify Reset
all settings. Next you can choose to save the current settings or just overwrite
them (likely the best choice), and then select Visual Basic Development
Settings.

Setting the Location of Project Files


You can change the default folder that VS uses to store and retrieve project
files. Select Tools / Options; in the Options dialog box, select Projects and
Solutions and change the entry for Visual Studio projects location.
18 Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008

8 A D VA N C E D P R O G R A M M I N G U S I N G V I S U A L B A S I C 2 0 0 8 Visual Studio and the .NET Framework

Setting Option Explicit and Option Strict Defaults


It’s best to set the Option Strict default for all projects, rather than set it in ev-
TIP
Set the default for Option Strict to
ery project. Select Projects and Solutions / VB Defaults in the Options dialog box
On now so that you don’t have to be
and set both Option Explicit and Option Strict on.
concerned about it in the future. ■
Displaying the Grid on Windows Forms
The Windows Form Designer includes snap lines, which is a great feature that can
help you to align controls. Blue snap lines appear when the edges of controls are
aligned; red snap lines appear when the text baselines of controls are aligned; and
dotted lines appear when two controls are the recommended distance apart. The
visible grid does not appear on a Windows Form by default, but you can make the
grid dots appear to match early versions of VB. In the Windows Forms Designer
section of the Options dialog box, select SnapToGrid for LayoutMode and True for
ShowGrid. Before setting this option, however, make sure to try using snap lines,
which make form design much easier than the old snap-to-grid method.

The Solution Explorer


Take a look at the files in the Solution Explorer for a new Windows application
(Figure 1.4). When you click on the Show All Files button, you can see the
Figure 1.4

Show All Files Click the Show All Files button


to see all of the files and folders
in the Solution Explorer.

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 Bin and Obj Folders


Notice the organization of the bin and obj folders:
bin
Debug
Release
obj
Debug
Release
When you compile and run a project using the debugger, you are running the
program stored in the bin\Debug folder. The debug versions of the compiled proj-
ect are not optimized for release. If you compile a program for release, the com-
piled versions are placed in the Release folders. Notice the files in the bin\Debug
folder in Figure 1.5, which shows the Solution Explorer after compiling a project.
Figure 1.5

After compiling a project and


clicking the Refresh button,
the bin\Debug folder holds the
files needed to run the program
in the debugger.

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

10 A D VA N C E D P R O G R A M M I N G U S I N G V I S U A L B A S I C 2 0 0 8 Visual Studio and the .NET Framework

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

The Resources folder holds the


project resources, such as
graphic and sound files, and
text strings.

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

the graphics is C:\Program Files\Microsoft Visual Studio 9.0\Common7\


VS2008ImageLibrary\1033\VS2008ImageLibrary.zip. You may have to unzip
the files to use them.

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.

The Form’s Designer-Generated Code


A big advantage of partial classes is that the VB Form Designer can split the
form’s class into two parts, separating the designer-generated code from the
developer-written code. In Figure 1.7, you can see that Form1 consists of two
files, plus the .resx file. Form1.vb holds the VB code that you write; Form1.
Designer.vb holds the designer-generated code. You don’t generally see these
extra files unless you select Show All Files in the Solution Explorer. You can
double-click a filename to see the contents of the file.
Figure 1.7

Form1.vb holds your VB code;


Form1.Designer.vb holds the
code automatically generated
by the Windows Form Designer.
Click on Show All Files to see
these normally hidden 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:

Partial Class Form1


Inherits System.Windows.Forms.Form

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:

Public Class Form1

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

12 A D VA N C E D P R O G R A M M I N G U S I N G V I S U A L B A S I C 2 0 0 8 Visual Studio and the .NET Framework

The Project Designer


The Project Designer is sometimes called the Project Properties dialog box. You
can open the Project Designer by double-clicking on the My Project folder in the
Solution Explorer or by selecting Project / ProjectName Properties. The Project
Designer includes tabs for Application, Compile, Debug, References, Resources,
Services, Settings, Signing, My Extensions, Security, and Publish (Figure 1.8).
Figure 1.8

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.

Deploying Windows Applications


Most of this text is devoted to writing and testing applications using the Visual
Studio IDE. However, once you get an application tested and ready for use, you
will want to deploy it and run it on another computer. To run a .NET Windows
application, the target computer must have the .NET Framework or the .NET
Framework Redistributable installed. The Redistributable file is available for
free download on Microsoft’s Web site and is available for Windows XP and Vista.
You can choose from several methods for deploying your Windows applica-
tions: (1) XCopy deployment, (2) Windows Installer technology, (3) ClickOnce
deployment, or (4) third-party installer products.
XCopy deployment gets its name from the old DOS XCOPY command, which
copied all files in the current folder and all subfolders. Although you can use the
XCOPY command for copying files, XCopy deployment simply means that you
copy the necessary files from the development machine to the target machine.
Deploying a compiled Windows application can be as easy as copying the
.exe file from the bin folder to another computer. This technique is not very
robust but can work for a simple installation. However, deploying a Web ap-
plication is a little more complicated because more than one file is needed to
run an application.
Microsoft Windows Installer is a separate application that ships with Win-
dows. The installer creates .msi files that contain the application and any sup-
port files needed for deployment. Deployment is covered in Appendix C.

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

Type “My.” to see the available


My objects in IntelliSense.
24 Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008

14 A D VA N C E D P R O G R A M M I N G U S I N G V I S U A L B A S I C 2 0 0 8 Visual Studio and the .NET Framework

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.

Using Assembly Information


You can set an application’s assembly information, also called the assembly
attributes, and retrieve the information at run time.

Setting the Assembly Information


You can view and set an application’s assembly information in the Assembly
Information dialog box. Double-click on My Project in the Solution Explorer
TIP
to display the Project Designer’s Application tab (refer to Figure 1.8); then Always give the new project a name
click on the Assembly Information button, which displays the dialog box. when you create it, which sets the
Figure 1.11 shows the default information for an application called root namespace, assembly name,
WindowsApplication1. and project name. ■

Figure 1.11

The Assembly Information


dialog box with the values
supplied by default. You can
edit the entries to the values of
your choice.
Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill 25
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008

C H A P T E R 1 15

Figure 1.12

The assembly information for


the chapter hands-on program-
ming example.

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

16 A D VA N C E D P R O G R A M M I N G U S I N G V I S U A L B A S I C 2 0 0 8 Visual Studio and the .NET Framework

Retrieving the Assembly Information


You can retrieve assembly attributes in a VB program using the My.Application.
Info object. The properties of the object include many items that describe the
application, including
• AssemblyName
• CompanyName
• Description
• DirectoryPath
• Copyright
• Trademark
• Name
• ProductName
• Title
• Version
You can display the Title attribute in a label using the following statement:

TitleLabel.Text = My.Application.Info.Title

The following program displays the assembly attributes in labels on a form.

Write a Test Program


Begin a new project in VB and double-click on the My Project folder in the So-
lution Explorer to open the Project Designer. Click on the Assembly Information
button to open the Assembly Information dialog box and enter the information
(Figure 1.14).
On the form, add labels for Name, Title, Description, Company, Product,
Version, and Copyright.
Figure 1.14

Enter the assembly information


for the demonstration program.
Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill 27
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008

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.

Private Sub MainForm_Load(ByVal sender As System.Object, _


ByVal e As System.EventArgs) Handles MyBase.Load
' Retrieve the assembly information.

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

Run the Test Program


Run the program. Your output should be similar to Figure 1.15.

Figure 1.15

The assembly information


displays in labels in the
example program’s output.

Viewing a Program’s Attributes


After you enter assembly information and compile your project, you can view
the attributes in Windows Explorer. Point to the filename in the project’s bin\
Debug folder, either an .exe or .dll file, and pause; the attributes pop up auto-
matically (Figure 1.16).
Figure 1.16

The application’s attributes


display when you pause the
mouse pointer over the filename
in Windows Explorer.
28 Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008

18 A D VA N C E D P R O G R A M M I N G U S I N G V I S U A L B A S I C 2 0 0 8 Visual Studio and the .NET Framework

➤ Feedback 1.2
Write the statements necessary to retrieve and display the copyright attribute
in CopyrightLabel.

Menus, Toolbars, and Status Bars


To create menus, context menus, toolbars, and status bars, use the components
in the Menus & Toolbars section of the toolbox (Figure 1.17). The components
are MenuStrip, ContextMenuStrip, ToolStrip, and StatusStrip.
Visual Studio also includes designers that simplify creating menus, tool-
bars, and status bars. The designers are pretty smart; they give each element a
meaningful name so that you don’t have to rename your menu items. You also
can use the controls’ smart tags, which simplify setting properties.
Figure 1.17

The MenuStrip,
ContextMenuStrip, ToolStrip,
and StatusStrip components
are grouped together in the
Menus & Toolbars section of
the toolbox.

Creating Menus with MenuStrips


When you add a MenuStrip to a form, the component appears in the component
tray and the words “Type Here” appear in the new menu bar. Notice in Fig-
ure 1.18 that when you point to the new menu item, a drop-down arrow appears,
which you can use to add different controls to the menu bar. The selected menu
bar also shows a smart tag arrow, which you can use to set some of the proper-
ties of the menu bar.
Figure 1.18

The MenuStrip component


appears in the component tray.
Smart tag arrow for MenuStrip Type your first menu item where
the words “Type Here” appear.
Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill 29
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008

C H A P T E R 1 19

The MenuStrip and ContextMenuStrip components allow you to select a


control or separator bar for each menu item. Drop down the list for a menu item
to see the choices (Figure 1.19). You can easily add a new item or a separator
bar in the menu.
Figure 1.19

Drop down the list for a new


menu item and make a
selection from the list.

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

MenuStrip's Smart tag Open the MenuStrip’s smart tag


to set properties of the menu
bar; select Edit Items to edit the
individual menu items.

TIP
The keyboard shortcut for opening
a smart tag when its arrow appears
is Alt + Shift + F10. ■

Menus and Menu Items


Each MenuStrip and ContextMenuStrip component is a container, which holds
a collection of menu items. Both top-level menus and the items below the menu
names are considered menu items. A menu item also can contain a collection
of items. For example, the File menu is a menu item, called FileToolStripMenu-
Item by default; the FileToolStripMenuItem contains a collection of the menu
items that appear in the File menu, such as ExitToolStripMenuItem.
Referring to Figure 1.21, notice that at the top-right side, the collection is
MenuStrip1, the MenuStrip itself. The items listed in the Members list are the
top-level menus.
30 Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008

20 A D VA N C E D P R O G R A M M I N G U S I N G V I S U A L B A S I C 2 0 0 8 Visual Studio and the .NET Framework

Figure 1.21

In the Items Collection Editor, you can add and remove menu items, reorder items, and set properties of the items.

Sort properties in alpha order

Object type MenuStrip1 is selected

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

Open Collection Editor for


items below the File menu
Bradley−Millspaugh: 1. Visual Studio and the Text © The McGraw−Hill 31
Advanced Programming .NET Framework Companies, 2010
Using Visual Basic 2008

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.

Creating Context Menus with ContextMenuStrips


Context menus are the shortcut menus that you display by pointing to an item
and right-clicking. You should plan your applications to include context menus
for all operations that the user might want to perform.
You create context menus in nearly the same way that you create menus.
Add a ContextMenuStrip to a form and add menu items using the visual menu
designer (Figure 1.23).

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

22 A D VA N C E D P R O G R A M M I N G U S I N G V I S U A L B A S I C 2 0 0 8 Visual Studio and the .NET Framework

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”.

Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, _


ByVal e As System.EventArgs)_
Handles ExitToolStripMenuItem.Click, ExitToolStripMenuItem1.Click
' Exit the program.

Me.Close()
End Sub

Creating Toolbars with ToolStrips


Toolbars typically hold buttons that are shortcuts to menu items. You will use
ToolStrip components to create toolbars.
TIP
ToolStrips are very closely related to MenuStrips. In fact, the MenuStrip Beware of using Application.Exit( )
class inherits from the ToolStrip class and shares many of the same properties as any code in the FormClosing
and behaviors. event will not execute. ■
You have many choices for the types of controls to add to a ToolStrip
(Figure 1.24).

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.

Image property appears


above

ToolTip

Name

the button. Figure 1.25 shows a ToolStripButton’s properties with an image,


ToolTip text, and a meaningful name.

Creating Status Bars with StatusStrips


Status bars generally appear at the bottom of a form and supply information to
the user. Some applications display error messages in status bars; often a status
bar holds the system date and time.
VB uses StatusStrip components to create status bars. StatusStrip compo-
nents, like MenuStrips and ContextMenuStrips, inherit from ToolStrips and
share many of the same characteristics. Figure 1.26 shows the controls that you
can add to a StatusStrip.
To display text on a status bar, add a StatusLabel to the StatusStrip. You
will want to give StatusLabel objects meaningful names since you will refer to
the labels in code. You can control whether labels appear at the right or left
end of the status bar by setting the StatusStrip’s RightToLeft property to Yes or
No. By default, the property is set to No and labels appear at the left end of the
status bar. You also can set a StatusLabel to appear at the left end of a status
bar and fill the status bar, even though RightToLeft is set to Yes and some
labels appear at the right end: Set the StatusLabel’s Spring property to true.
You can display the date and time in status labels in the Form_Load event
handler.

Private Sub MenuForm_Load(ByVal sender As System.Object, _


ByVal e As System.EventArgs) Handles MyBase.Load
' Set the date and time in the status bar.

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

24 A D VA N C E D P R O G R A M M I N G U S I N G V I S U A L B A S I C 2 0 0 8 Visual Studio and the .NET Framework

Figure 1.26

Drop down the list to add a


control to a StatusStrip.

Displaying the Date and Time


You use the properties and methods of the DateTime structure to retrieve
and format the current date and time. The Now property holds the system
date and time in a numeric format that can be used for calculations. You can
format the date and/or time for display using one of the following meth-
ods: ToShortDateString, ToLongDateString, ToShortTimeString, or
ToLongTimeString. The actual display format of each method depends on the
local system settings.
You can set the display value of StatusStripLabels in any procedure; however,
the display does not update automatically. Generally, you will set initial values in
the Form_Load event procedure and use a Timer component to update the time.

Using a Timer Component


To use a Timer component, you add the component to the form, set some
properties, and write code in the Timer’s Tick event handler. Add the Timer
component from the Components section of the toolbox. Then in the Properties
window, set the Enabled property to true and set the Interval property. The In-
terval is measured in milliseconds; set the Interval to 1000 to make the Timer’s
Tick event fire every second.

Private Sub Timer1_Tick(ByVal sender As System.Object, _


ByVal e As System.EventArgs) Handles Timer1.Tick
' Update the time in the status bar.

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.

Multiple Document Interface


You can create forms as a single document interface (SDI) or multiple
document interface (MDI). Using SDI, each form in the project acts inde-
pendently from the other forms. However, VB also allows you to create a mul-
tiple document interface. For an example of MDI, consider an application such
as Microsoft Word 2003, which has a parent form (the main window) and
child forms (each document window). You can open multiple child windows,
and you can maximize, minimize, restore, or close each child window, which
always stays within the boundaries of the parent window. When you close the
parent window, all child windows close automatically. Figure 1.27 shows an
MDI parent window with two open child windows.
Figure 1.27

The main form is the parent and


the smaller forms are the child
forms in an MDI application.

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.

How does your garden grow?


With silver bells and cockle shells,
And pretty maids all of a row.

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.

A home to rest, a shelter to defend.

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.

Now is the May of life.

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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebooknice.com

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy