Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (5 votes)
22 views

Visual Basic 2012 Programmer s Reference 1st Edition Rod Stephens 2024 scribd download

Programmer

Uploaded by

hacaraltruy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (5 votes)
22 views

Visual Basic 2012 Programmer s Reference 1st Edition Rod Stephens 2024 scribd download

Programmer

Uploaded by

hacaraltruy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

Download the full version of the ebook at ebookname.

com

Visual Basic 2012 Programmer s Reference 1st


Edition Rod Stephens

https://ebookname.com/product/visual-basic-2012-programmer-
s-reference-1st-edition-rod-stephens/

OR CLICK BUTTON

DOWNLOAD EBOOK

Download more ebook instantly today at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Visual Basic 2005 Programmer s Reference 1st Edition Rod


Stephens

https://ebookname.com/product/visual-basic-2005-programmer-s-
reference-1st-edition-rod-stephens/

ebookname.com

Visual Basic 2010 Programmer s Reference 1st Edition Rod


Stephens

https://ebookname.com/product/visual-basic-2010-programmer-s-
reference-1st-edition-rod-stephens/

ebookname.com

C 5 0 Programmer s Reference 1st Edition Rod Stephens

https://ebookname.com/product/c-5-0-programmer-s-reference-1st-
edition-rod-stephens/

ebookname.com

Hysteroscopy Resectoscopy and Endometrial Ablation 1st


Edition Eric J. Bieber

https://ebookname.com/product/hysteroscopy-resectoscopy-and-
endometrial-ablation-1st-edition-eric-j-bieber/

ebookname.com
Integrating Inspection Management into Your Quality
Improvement System 1st Edition William D. Mawby

https://ebookname.com/product/integrating-inspection-management-into-
your-quality-improvement-system-1st-edition-william-d-mawby/

ebookname.com

Elementary Differential Equations 10th Edition William E.


Boyce

https://ebookname.com/product/elementary-differential-equations-10th-
edition-william-e-boyce/

ebookname.com

Reader s Guide to Music History Theory and Criticism


Murray Steib (Editor)

https://ebookname.com/product/reader-s-guide-to-music-history-theory-
and-criticism-murray-steib-editor/

ebookname.com

Cascades of Violence War Crime and Peacebuilding Across


South Asia 1st Edition John Braithwaite

https://ebookname.com/product/cascades-of-violence-war-crime-and-
peacebuilding-across-south-asia-1st-edition-john-braithwaite/

ebookname.com

Afterschool Images Education and Research 1st Edition


Nancy Vansieleghem

https://ebookname.com/product/afterschool-images-education-and-
research-1st-edition-nancy-vansieleghem/

ebookname.com
Word 2010 For Dummies Dan Gookin

https://ebookname.com/product/word-2010-for-dummies-dan-gookin/

ebookname.com
VISUAL BASIC® 2012
PROGRAMMER’S REFERENCE

INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii

 PART I IDE
CHAPTER 1 Introduction to the IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
CHAPTER 2 Menus, Toolbars, and Windows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15
CHAPTER 3 Windows Forms Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
CHAPTER 4 WPF Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
CHAPTER 5 Visual Basic Code Editor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
CHAPTER 6 Debugging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

 PART II GETTING STARTED


CHAPTER 7 Selecting Windows Forms Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81
CHAPTER 8 Using Windows Forms Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
CHAPTER 9 Windows Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
CHAPTER 10 Selecting WPF Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
CHAPTER 11 Using WPF Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
CHAPTER 12 WPF Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
CHAPTER 13 Program and Module Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
CHAPTER 14 Data Types, Variables, and Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
CHAPTER 15 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
CHAPTER 16 Subroutines and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
CHAPTER 17 Program Control Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
CHAPTER 18 Error Handling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
CHAPTER 19 Database Controls and Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
CHAPTER 20 LINQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
CHAPTER 21 Metro-Style Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .417
 PART III OBJECT-ORIENTED PROGRAMMING
CHAPTER 22 OOP Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
CHAPTER 23 Classes and Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
CHAPTER 24 Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
CHAPTER 25 Collection Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
CHAPTER 26 Generics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515

 PART IV INTERACTING WITH THE ENVIRONMENT


CHAPTER 27 Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529
CHAPTER 28 Configuration and Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
CHAPTER 29 Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571
CHAPTER 30 Filesystem Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585

 PART V APPENDICES
APPENDIX A Useful Control Properties, Methods, and Events . . . . . . . . . . . . . . . . . . . 611
APPENDIX B Variable Declarations and Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 619
APPENDIX C Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629
APPENDIX D Subroutine and Function Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . 637
APPENDIX E Control Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
APPENDIX F Error Handling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647
APPENDIX G Windows Forms Controls and Components . . . . . . . . . . . . . . . . . . . . . . 649
APPENDIX H WPF Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657
APPENDIX I Visual Basic Power Packs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665
APPENDIX J Form Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669
APPENDIX K Classes and Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681
APPENDIX L LINQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685
APPENDIX M Generics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695
APPENDIX N Graphics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699
APPENDIX O Useful Exception Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
APPENDIX P Date and Time Format Specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715
APPENDIX Q Other Format Specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719
APPENDIX R The Application Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725
APPENDIX S The My Namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729
APPENDIX T Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 747
APPENDIX U Filesystem Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 755
APPENDIX V Visual Studio Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .771

INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773
Visual Basic® 2012
PROGRAMMER’S REFERENCE

Rod Stephens

John Wiley & Sons, Inc.


Visual Basic® 2012 Programmer’s Reference
Published by
John Wiley & Sons, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com

Copyright © 2012 by John Wiley & Sons, Inc., Indianapolis, Indiana

Published simultaneously in Canada

ISBN: 978-1-118-31407-4
ISBN: 978-1-118-33208-5 (ebk)
ISBN: 978-1-118-33535-2 (ebk)
ISBN: 978-1-118-43938-8 (ebk)

Manufactured in the United States of America

10 9 8 7 6 5 4 3 2 1

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108
of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization
through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers,
MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the
Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011,
fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.

Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with
respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including
without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or pro-
motional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold
with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services.
If professional assistance is required, the services of a competent professional person should be sought. Neither the pub-
lisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to
in this work as a citation and/or a potential source of further information does not mean that the author or the publisher
endorses the information the organization or Web site may provide or recommendations it may make. Further, readers
should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was
written and when it is read.

For general information on our other products and services please contact our Customer Care Department within the
United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.

Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with stan-
dard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such
as a CD or DVD that is not included in the version you purchased, you may download this material at
http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.

Library of Congress Control Number: 2012940034

Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress are
trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affi liates, in the United States and other coun-
tries, and may not be used without written permission. Visual Basic is a registered trademark of Microsoft Corporation.
All other trademarks are the property of their respective owners. John Wiley & Sons, Inc., is not associated with any
product or vendor mentioned in this book.
ABOUT THE AUTHOR

ROD STEPHENS started out as a mathematician, but while studying at MIT, he


discovered how much fun programming is and has been programming profes-
sionally ever since. During his career, he has worked on an eclectic assortment of
applications in such fields as telephone switching, billing, repair dispatching, tax
processing, wastewater treatment, concert ticket sales, cartography, and training
for professional football players.
Rod is a Microsoft Visual Basic Most Valuable Professional (MVP) and has taught
introductory programming at ITT Technical Institute. He has written more than
two dozen books that have been translated into languages from all over the world, and more than
250 magazine articles covering Visual Basic, C#, Visual Basic for Applications, Delphi, and Java.
Rod’s popular VB Helper website (www.vb-helper.com) receives several million hits per month and
contains thousands of pages of tips, tricks, and example programs for Visual Basic programmers,
as well as example code for this book. His C# Helper website (www.csharphelper.com) contains
similar material for C# programmers.
You can contact Rod at RodStephens@csharphelper.com or RodStephens@vb-helper.com.

ABOUT THE TECHNICAL EDITOR

BRIAN HOCHGURTEL has been doing .NET development for over ten years, and actually started his
.NET experience with Rod Stephens when they wrote the Wiley book Visual Basic .NET and XML
together in 2002. Currently Brian works as a SharePoint Developer and Administrator for a large
defense contractor in Colorado.
CREDITS

Executive Editor Production Manager


Robert Elliott Tim Tate

Senior Project Editor Vice President and Executive Group


Adaobi Obi Tulton Publisher
Richard Swadley
Technical Editor
Brian Hochgurtel Vice President and Executive Publisher
Neil Edde
Production Editor
Daniel Scribner Associate Publisher
Jim Minatel
Copy Editor
Kim Cofer Project Coordinator, Cover
Katie Crocker
Editorial Manager
Mary Beth Wakefield Proofreader
Nicole Hirschman
Freelancer Editorial Manager
Rosemarie Graham Indexer
Ron Strauss
Associate Director of Marketing
David Mayhew Cover Designer
Ryan Sneed
Marketing Manager
Ashley Zurcher Cover Image
© Erik Isakson / Tetra Images / JupiterImages
Business Manager
Amy Knies
ACKNOWLEDGMENTS

THANKS TO BOB ELLIOTT, Adaobi Obi Tulton, Sydney Jones, Rayna Erlick, Kim Cofer, Daniel
Scribner, and all of the others who worked so hard to make this book possible.
Thanks also to Brian Hochgurtel for giving me another perspective and the benefit of his valuable
experience.
CONTENTS

INTRODUCTION xxvii

PART I: IDE

CHAPTER 1: INTRODUCTION TO THE IDE 3

Introducing the IDE 3


Different IDE Appearances 4
IDE Configurations 5
Projects and Solutions 6
Starting the IDE 6
Creating a Project 8
Saving a Project 11
Summary 13
CHAPTER 2: MENUS, TOOLBARS, AND WINDOWS 15

IDE Tools 15
Menus 16
File 16
Edit 18
View 19
Project 20
Build 24
Debug 24
Data 24
Format 25
Tools 25
Test 28
Window 28
Help 29
Toolbars 30
Secondary Windows 30
Toolbox 32
Properties Window 33
Summary 33
CONTENTS

CHAPTER 3: WINDOWS FORMS DESIGNER 35

Introducing Windows Forms Designer 35


Setting Designer Options 35
Adding Controls 37
Selecting Controls 38
Copying Controls 39
Moving and Sizing Controls 40
Arranging Controls 40
Setting Properties 40
Setting Group Properties 41
Using Smart Tags 41
Adding Code to Controls 42
Summary 43
CHAPTER 4: WPF DESIGNER 45

Introducing WPF Designer 45


Editor Weaknesses 46
Recognizing Designer Windows 47
Adding Controls 48
Selecting Controls 49
Moving and Sizing Controls 50
Setting Properties 51
Setting Group Properties 51
Adding Code to Controls 52
Summary 53
CHAPTER 5: VISUAL BASIC CODE EDITOR 55

Editing Code 55
Margin Icons 56
Outlining 58
Tooltips 59
IntelliSense 60
Code Coloring and Highlighting 61
Code Snippets 63
Architectural Tools 64
Rename 64
Go To Definition 64
Go To Type Definition 64
Highlight References 65
Find All References 65
Generate From Usage 65

xii
CONTENTS

The Code Editor at Run Time 66


Summary 68
CHAPTER 6: DEBUGGING 69

Debugging and Testing 69


The Debug Menu 70
The Debug ➪ Windows Submenu 72
The Breakpoints Window 74
The Command and Immediate Windows 75
Summary 77

PART II: GETTING STARTED


CHAPTER 7: SELECTING WINDOWS FORMS CONTROLS 81

Controls 81
Controls Overview 82
Choosing Controls 86
Containing and Arranging Controls 87
Making Selections 89
Entering Data 90
Displaying Data 90
Providing Feedback 91
Initiating Action 92
Displaying Graphics 94
Displaying Dialog Boxes 94
Third-Party Controls 95
Summary 96
CHAPTER 8: USING WINDOWS FORMS CONTROLS 97

Using Controls and Components 97


Controls and Components 98
Creating Controls 99
Properties 101
Properties at Design Time 101
Properties at Run Time 104
Useful Control Properties 106
Position and Size Properties 109
Methods 110
Events 110

xiii
CONTENTS

Creating Event Handlers at Design Time 111


Validation Events 112
Summary 114

CHAPTER 9: WINDOWS FORMS 115

Using Forms 115


Transparency 116
About, Splash, and Login Forms 117
Mouse Cursors 118
Icons 120
Application Icons 121
Notification Icons 121
Properties Adopted by Child Controls 122
Property Reset Methods 123
Overriding WndProc 123
MRU Lists 125
Dialog Boxes 126
Wizards 128
Summary 129
CHAPTER 10: SELECTING WPF CONTROLS 131

WPF Controls and Code 131


Controls Overview 132
Containing and Arranging Controls 133
Making Selections 136
Entering Data 137
Displaying Data 137
Providing Feedback 138
Initiating Action 138
Presenting Graphics and Media 139
Providing Navigation 140
Managing Documents 140
Digital Ink 141
Summary 142
CHAPTER 11: USING WPF CONTROLS 143

WPF Controls 143


WPF Concepts 144
Separation of User Interface and Code 144
WPF Control Hierarchies 145

xiv
CONTENTS

WPF in the IDE 145


Editing XAML 146
Editing Visual Basic Code 147
XAML Features 148
Objects 148
Resources 151
Styles 152
Templates 153
Transformations 156
Animations 156
Drawing Objects 159
Procedural WPF 162
Documents 166
Flow Documents 166
Fixed Documents 168
XPS Documents 169
Summary 169

CHAPTER 12: WPF WINDOWS 171

Using WPF Windows 171


Window Applications 172
Page Applications 174
Browser Applications 174
Frame Applications 176
Summary 177

CHAPTER 13: PROGRAM AND MODULE STRUCTURE 179

Solutions and Projects 179


Hidden Files 180
Code File Structure 184
Code Regions 185
Conditional Compilation 186
Namespaces 193
Typographic Code Elements 195
Comments 195
XML Comments 195
Line Continuation 198
Implicit Line Continuation 199
Line Joining 200
Summary 200

xv
CONTENTS

CHAPTER 14: DATA TYPES, VARIABLES, AND CONSTANTS 203

Variables 203
Data Types 204
Type Characters 207
Data Type Conversion 210
Narrowing Conversions 210
Data Type Parsing Methods 212
Widening Conversions 213
The Convert Class 213
ToString 213
Variable Declarations 214
Attribute_List 214
Accessibility 215
Shared 216
Shadows 216
ReadOnly 219
Dim 219
WithEvents 220
Name 221
Bounds_List 222
New 223
As Type and Inferred Types 224
Initialization_Expression 225
Initializing Collections 228
Multiple Variable Declarations 229
Option Explicit and Option Strict 230
Scope 233
Block Scope 233
Procedure Scope 234
Module Scope 234
Namespace Scope 235
Restricting Scope 235
Parameter Declarations 236
Property Procedures 238
Enumerated Data Types 240
Anonymous Types 243
Nullable Types 244
Constants 244
Accessibility 245
As Type 245
Initialization_Expression 246

xvi
CONTENTS

Delegates 246
Naming Conventions 248
Summary 249
CHAPTER 15: OPERATORS 251

Understanding Operators 251


Arithmetic Operators 252
Concatenation Operators 253
Comparison Operators 253
Logical Operators 255
Bitwise Operators 257
Operator Precedence 257
Assignment Operators 259
The StringBuilder Class 260
Date and TimeSpan Operations 261
Operator Overloading 262
Summary 266
CHAPTER 16: SUBROUTINES AND FUNCTIONS 267

Managing Code 267


Subroutines 268
Attribute_List 268
Inheritance_Mode 272
Accessibility 273
Subroutine_Name 274
Parameters 274
Implements interface.subroutine 279
Statements 281
Functions 281
Property Procedures 283
Extension Methods 284
Lambda Functions 285
Relaxed Delegates 287
Asynchronous Methods 290
Calling EndInvoke Directly 291
Handling a Callback 293
Using Async and Await 295
Summary 297

xvii
CONTENTS

CHAPTER 17: PROGRAM CONTROL STATEMENTS 299

Controlling Programs 299


Decision Statements 299
Single-Line If Then 300
Multiline If Then 300
Select Case 301
Enumerated Values 304
IIf 304
If 306
Choose 306
Looping Statements 308
For Next 308
Non-Integer For Next Loops 311
For Each 311
Enumerators 314
Iterators 316
Do Loop Statements 316
While End 318
Summary 318

CHAPTER 18: ERROR HANDLING 321

The Struggle for Perfection 321


Bugs versus Unplanned Conditions 322
Catching Bugs 323
Catching Unplanned Conditions 324
Global Exception Handling 326
Structured Error Handling 328
Exception Objects 330
Throwing Exceptions 331
Re-throwing Exceptions 333
Custom Exceptions 334
Debugging 335
Summary 336
CHAPTER 19: DATABASE CONTROLS AND OBJECTS 337

Data Sources 337


Automatically Connecting to Data 338
Connecting to the Data Source 338
Adding Data Controls to the Form 341
Automatically Created Objects 344

xviii
CONTENTS

Other Data Objects 345


Data Overview 346
Connection Objects 347
Transaction Objects 350
Data Adapters 352
Command Objects 356
DataSet 358
DataTable 360
DataRow 363
DataColumn 365
DataRelation 366
Constraints 368
DataView 370
DataRowView 373
Simple Data Binding 373
CurrencyManager 374
Complex Data Binding 377
Summary 379
CHAPTER 20: LINQ 381

The Many Faces of LINQ 381


Introduction to LINQ 383
Basic LINQ Query Syntax 384
From 385
Where 386
Order By 386
Select 387
Using LINQ Results 389
Advanced LINQ Query Syntax 390
Join 390
Group By 391
Aggregate Functions 393
Set Operations 394
Limiting Results 394
LINQ Functions 395
LINQ Extension Methods 397
Method-Based Queries 397
Method-Based Queries with Lambda Functions 399
Extending LINQ 401
LINQ to Objects 403
LINQ to XML 404
XML Literals 404

xix
CONTENTS

LINQ into XML 405


LINQ out of XML 406
LINQ to ADO.NET 409
LINQ to SQL and LINQ to Entities 409
LINQ to DataSet 410
PLINQ 413
Summary 414
CHAPTER 21: METRO-STYLE APPLICATIONS 417

Building Metro-Style Applications 417


Starting a New Project 418
Special Image Files 419
Building MetroBones 420
Control Layout 421
XAML Code 421
Zooming in on the Controls 424
Visual Basic Code 424
Testing 428
Summary 429

PART III: OBJECT-ORIENTED PROGRAMMING

CHAPTER 22: OOP CONCEPTS 433

Introducing OOP 433


Classes 434
Encapsulation 436
Inheritance 437
Inheritance Hierarchies 438
Refinement and Abstraction 438
“Has-a” and “Is-a” Relationships 441
Adding and Modifying Class Features 441
Interface Inheritance 443
Polymorphism 444
Method Overloading 445
Extension Methods 446
Summary 447
CHAPTER 23: CLASSES AND STRUCTURES 449

Packaging Data 449


Classes 450

xx
CONTENTS

Attribute_list 450
Partial 451
Accessibility 452
Shadows 453
Inheritance 454
Implements interface 456
Structures 456
Structures Cannot Inherit 457
Structures Are Value Types 457
Memory Required 457
Heap and Stack Performance 459
Object Assignment 459
Parameter Passing 460
Boxing and Unboxing 461
Class Instantiation Details 461
Structure Instantiation Details 464
Garbage Collection 466
Finalize 467
Dispose 469
Constants, Properties, and Methods 471
Events 473
Declaring Events 473
Raising Events 474
Catching Events 475
Shared Variables 477
Shared Methods 477
Summary 479

CHAPTER 24: NAMESPACES 481

Handling Name Conflicts 481


The Imports Statement 482
Automatic Imports 484
Namespace Aliases 486
Namespace Elements 486
The Root Namespace 487
Making Namespaces 487
Classes, Structures, and Modules 488
Resolving Namespaces 489
Summary 492

xxi
CONTENTS

CHAPTER 25: COLLECTION CLASSES 493

Grouping Data 493


What Is a Collection? 494
Arrays 494
Array Dimensions 496
Lower Bounds 497
Resizing 497
Speed 498
Other Array Class Features 498
Collections 499
ArrayList 499
StringCollection 501
NameValueCollection 501
Dictionaries 503
ListDictionary 503
Hashtable 504
HybridDictionary 505
StringDictionary 505
SortedList 505
CollectionsUtil 505
Stacks and Queues 506
Stack 506
Queue 508
Generics 509
Collection Initializers 511
Iterators 512
Summary 513
CHAPTER 26: GENERICS 515

Class Creators 515


Advantages of Generics 516
Defining Generics 516
Generic Constructors 517
Multiple Types 518
Constrained Types 520
Instantiating Generic Classes 521
Imports Aliases 522
Derived Classes 523
Generic Collection Classes 523
Generic Methods 524

xxii
CONTENTS

Generics and Extension Methods 524


Summary 526

PART IV: INTERACTING WITH THE ENVIRONMENT

CHAPTER 27: PRINTING 529

Printing Concepts 529


Basic Printing 530
Drawing Basics 534
Graphics Objects 534
Pens 536
Brushes 538
A Booklet Example 540
Summary 545
CHAPTER 28: CONFIGURATION AND RESOURCES 547

The Need for Configuration 547


My 548
Me and My 549
My Sections 549
Environment 550
Setting Environment Variables 550
Using Environ 551
Using System.Environment 551
Registry 553
Native Visual Basic Registry Methods 554
My.Computer.Registry 556
Configuration Files 559
Resource Files 562
Application Resources 562
Using Application Resources 563
Embedded Resources 564
Localization Resources 564
Application 566
Application Properties 566
Application Methods 567
Application Events 568
Summary 569

xxiii
Random documents with unrelated
content Scribd suggests to you:
“Yes, but—”
“Well, now, look,” I said, importing a sudden harshness into my
tones, “you hated the thought of marrying Sir Philip and his death
would mean your release, besides which it would mean wealth to
your brother and a happy issue from his financial—”
“But the suggestion is infamous, intolerable!” Thoyne cried.
“Don’t be a fool,” I advised him. “I am not accusing Miss Clevedon; I
am summarising the case against her brother. The first essential is
to establish a motive and there you have one twice over—Sir Philip’s
death would release his sister from a hateful marriage and it would—
he would succeed to the dead man’s title and money. I am being
purposely brutal because I want to put it at its worst. He comes to
Midlington, a few miles from Cartordale on the day before the
tragedy, he leaves Midlington for some unknown destination, which
may, however, have been Cartordale, a few hours before the murder,
he knows a secret way into White Towers, and he has a dual motive
for assassinating Sir Philip. You have summed all this up in your
own minds, haven’t you? It has been a dark shadow in your
thoughts ever since that tragic day. Isn’t that so?”
There was a long silence.
“Yes,” Thoyne said at length, “you are perfectly right. You have
described exactly what, as I said before, has been a ceaseless
nightmare to us. And you have omitted the main difficulty. Why
doesn’t he come to Cartordale?”
“But, now,” I went on, “let us take the other side. There is no
evidence of any sort that Clevedon ever had any prussic acid in his
possession. Or is there?”
“We know of none,” Thoyne assented eagerly.
“And you?” I asked, turning to Kitty.
“No,” she said, shaking her head, “I never heard of any.”
“And then there is the possibility that when he left Midlington he
never came to Cartordale at all. That is where our investigation
begins. Where did he go when he left Midlington? Let us return to
your interview in the ‘King’s Head.’ At what time did it take place?”
“In the afternoon,” Thoyne responded. “It would be three o’clock
when we left the ‘King’s Head.’”
“And did he give you no indication of the nature of his engagement?”
“Nothing at all.”
“Did he say when he was coming to Cartordale?”
“No, I don’t think he mentioned it—at all events, nothing definite.”
“Well, now, let me put it like this. Suppose that after the meeting at
Midlington there had been no tragedy, would your brother’s
prolonged absence have worried you?”
“Oh, no,” Kitty replied. “One never knew what Billy was going to do
and frequently he wasn’t sure himself. He would just do it.”
“Did you know,” I asked, “that your brother was going on a long
leave. It is rather a wonder that Thoyne’s letter ever reached him,
but evidently it did. The fact that he had obtained leave before the
receipt of that letter suggests some contemplated purpose—the visit
to Midlington was only a break in the journey.”
“Yes,” Thoyne said, “we have thought all that out. But why hasn’t he
come back when—it is unbelievable that he should have seen
nothing—no account of the—”
“Unlikely, but not impossible,” I observed. “He may have met with an
accident, for example.”
“We should have heard of it,” Thoyne said, shaking his head.
“Well, anyway,” I returned, as cheerfully as I could, “suppose we
accord him the right every Briton has under the law, of being
regarded as innocent until he is proved guilty. Is he, by the way,
interested, do you know, in any—lady?”
“In about a hundred, I should think,” Thoyne returned.
“Yes, I dare say he would be. At his age one is. But I mean any
special lady?”
But they could give me no help in that.
CHAPTER XVIII
THE ANONYMOUS LETTERS

The first thing I had to settle was as regards the entrance to White
Towers of which Kitty Clevedon had spoken. We had to pick up Billy
Clevedon’s tracks after he left Midlington, and if he really had gone
to White Towers, it would probably be by that route. At all events
there was absolutely no evidence he had been seen at any of the
usual entrances. Kitty agreed to guide us, and told us to meet her
the following morning at the main gates to White Towers; and she
advised us also to put on some old clothes as we should have to
creep part of the way on hands and knees.
We were prompt to time and Kitty took us through the park to some
very rough ground at the rear of the house, though not far away from
it, and there she showed us a narrow cleft in a mass of rock and told
us that was the entrance. It was partly choked by a jumble of fallen
boulders overgrown with the rough vegetation of the moor, probably
rank enough at some periods of the year, but lying now for the most
part dry and dead. I looked for any sign of recent entrance,
especially for footmarks; but the ground was too hard and revealed
nothing, though the rubbish at the entrance seemed to have some
appearance of being trampled. I took out my flash lamp and pushed
my way into the opening, followed by the others, though it was a very
tight fit for Thoyne.
A wall of rock confronted us at about four feet, but Kitty bade us turn
to the left and there I saw an opening low down which seemed to
lead to a passage that descended somewhere into a mass of pitch
darkness. We had to get on hands and knees and crawl along so for
quite a long distance through a low, narrow tunnel that appeared to
be for the most part natural, though here and there, it had evidently
been widened at least, if not entirely pierced by human agency.
Presently, after going steadily downwards for many yards, it went
forward on the level, and was there a little higher and wider; but at
no point did it enable us to stand erect. It was a case of creeping all
the way. I understood now why Kitty had advised the oldest possible
clothing. It meant ruin to the knees of one’s trousers. And then the
tunnel ended abruptly against a wall of solid rock; but Kitty cried out
that there was an iron ring close to my right hand, and that I must
take hold of it and pull hard.
I obeyed; there was a grinding and groaning as of rusty machinery
and then the rock in front swung back and we found ourselves in an
open chamber with walls and floor of natural rock, but a roof of
worked stone formed of square flags, all save one supported by
pillars of rusty iron. There were nine stone flags, each six feet by
four, and eight pillars, and the dimensions of the cellar or cave were
thus eighteen feet by twelve. The height would probably be about
eight feet. We could at least stand upright. I took my flash lamp and
carefully examined every corner, not, as it turned out, quite
unremuneratively. I dropped my hat and then stooped to pick it up
again—and with it something I had noticed lying there.
My find was a hairpin still fresh and bright and with no sign of rust
about it.
If Kitty Clevedon had passed that way I should have supposed that
she had dropped it. Ladies shed things of that sort as they go. But
she had assured us that she had not been near the spot; in which
case a knowledge of the existence of the passage, supposed to be
confined to Kitty and her brother, was shared by someone else, and
that a woman.
“Which is the way out?” I asked, saying nothing of the hairpin which,
at a favourable opportunity, I thrust into my waistcoat pocket.
Kitty pointed to the one unsupported flagstone and told us that it
worked on a swivel and could be pushed up if one could reach it,
whereupon Thoyne swarmed up the nearest pillar and tried to move
the stone but failed, though whether because the axle was rusty or
because there was some fastening on the other side we could not
say. Thoyne selected another pillar and once more gave the stone a
push, but with no more success than before. From his position,
clinging monkey-like to the pillar, he could exert very little leverage.
He slid down again and suggested that I should mount his shoulders
so as to be right under the stone, a manœuvre which was promptly
attempted with satisfactory results.
The stone moved, though slowly and stubbornly and with much
creaking and, swinging myself up through the opening thus
disclosed, I found myself in a cellar full of a miscellaneous collection
of rubbish, baskets, boxes, barrels, chairs, broken furniture of all
sorts, books and papers and so on. I fixed the stone in position,
because left to itself it would simply have swung back again into its
place, and then I passed down to the others a short ladder which I
found lying against one of the walls of the cellar.
When the others had joined me, Kitty explained that we were under
the older portion of White Towers, the East Wing, which was partly in
ruins and uninhabited.
I was easily able to explain the tunnel—I had seen something of the
sort in other old houses. It was simply a way of escape for those
inside if enemies became too pressing. Peakshire had played a
strenuous part in the Civil War, most of the big men being on the side
of the King and White Towers, the older part of which dated back
beyond Elizabeth, had probably been a Royalist stronghold and
meeting place. If enemies, in the shape of Cromwell’s men, came
along, the Cavaliers would only have to creep through the tunnel in
order to escape the Roundheads. Or it may have been constructed
in even earlier days for the benefit of Roman Catholic refugees.
That, however, was mere speculation, though not without interest.
For many years evidently it had been unused and forgotten until it
was rediscovered by the two children who had kept it a delightful
secret to themselves and had, no doubt, brought it into many exciting
games. The question for us, however, was—had Clevedon used it
recently, and if so, for what purpose? It was certainly interesting and
possibly significant that somebody evidently had been that way not
so very long before. But Clevedon at all events did not use hairpins.
“There seems to be no evidence that your brother ever came this
way,” I said, as we stood looking round us. “True, the vegetation at
the entrance to that passage bore some appearance of having been
trampled down, though that may have been the weather or—”
“I did that,” Thoyne broke in quickly. “Kitty told me about this before I
saw you and I went to look for myself.”
I glanced at him casually. It was quite likely he spoke the truth.
“Did you get as far as this?” I asked.
“Oh, no, I didn’t get beyond the entrance.”
“And you think you trampled that brushwood?”
“I—it is possible I may have done.”
“You did not notice its condition before—?”
“No, I didn’t, I wasn’t looking for that. I see you still distrust me,” he
added quickly, “but I am perfectly honest about it. I am sorry I
came.”
“Oh, it doesn’t matter,” I returned carelessly. “If you hadn’t been
there, the signs might have proved that Clevedon hadn’t either,
whereas now it is an open question. But the fact that somebody may
have been there is of minor importance unless there is
accompanying evidence that the somebody was Clevedon himself.
Of course, there is the fact that he alone knew of the entrance—he
and one other. I suppose you haven’t been here lately?”
I turned suddenly on Kitty Clevedon and rapped out the question
with the abruptness of a pistol shot. She started a little, then shook
her head.
“Not since I was a child,” she replied.
“Can we get out of this without returning by that passage?” I asked.
“Yes, through that door is a flight of stone steps leading to what used
to be the kitchen of the old White Abbey.”
“We’ll go that way,” I decided.
When I had parted from my two companions, with a promise to see
them again later in the day, or, possibly on the following morning, I
went into the post office and from my waistcoat pocket produced a
hairpin.
“Have you any of that sort in stock?” I asked, then, noting her look of
surprise, I added, “I hope you won’t give me away if I tell you that I
use them to clean my pipe. They are the best things I know for that.”
“Well, I didn’t suppose you wanted them for your hair,” she said
pertly. “Yes, we have plenty of that sort in stock. Indeed, I don’t
think we have any others.”
“Then I suppose every lady in the Dale uses them,” I remarked
jestingly.
“Most of them,” she agreed. “I do—see, here is one”—and she
extracted a specimen from her own abundant head-covering. “A few
may get some others when they go into Midlington, but most come
here for them. Lady Clevedon had three boxes only a week ago.”
“Lady Clevedon,” I echoed, “then they must be an aristocratic brand.
Does her ladyship do her own shopping?”
“Oh, they are good enough. No, Lady Clevedon didn’t come for
them—Miss Kitty fetched them. She said they were for Lady
Clevedon, but she took some for herself too, so I suppose she wears
them.”
Evidently the hairpin was not going to be of much use to me, at all
events as a means of identification. There would be too many of
them about the Dale for that.
When I reached Stone Hollow again I found Detective Pepster
awaiting me, looking, for him, a little disconsolate.
“Well,” was my greeting, “how has Fate treated you?”
“No luck, none at all,” Pepster said gloomily. “I am just back from
Dublin with no news. Clevedon went to Dublin on February 20th, but
there all trace of him ended. I could learn nothing.”
“I have been more fortunate than you,” I returned smilingly. “I can
carry him a bit farther than that. He was in Midlington on February
22nd and left there on the morning of the 23rd.”
“Do you know that?”
“Yes, for certain.”
“Did he go to Cartordale—to White Towers?”
“I can’t say for that.”
“And where is he now?”
“Nobody knows.”
“And his sister—?”
“Is as ignorant as you or I.”
“She is bluffing?”
“No.”
“She really doesn’t know where he is?”
“She really doesn’t.”
“But—anyway we must find him.”
“I am busy at it now.”
“Any traces?”
“None.”
“It is a weird development. Did he do it? Is he keeping out of the
way because—?”
“It is impossible to say. We know that he came to Midlington, but
that he came to Cartordale or ever had any prussic acid in his
possession—”
“Yes, you’re right. We must bring him a little nearer than Midlington.
But if he didn’t do it, or, for the matter of that, if he did, he is a fool for
keeping out of the way.”
Which at least was a self-evident proposition.
“And now that we have disposed of Billy Clevedon for the time
being,” Pepster went on, “tell me what you think of this.”
With great deliberation he took a letter-case from his pocket and
from it extracted a sheet of paper which he handed over to me. It
was lined paper, torn evidently from a notebook, and on it was
printed in capitals:

YOU ARE ON THE WRONG


TRAIL ALTOGETHER. IF
YOU WANT TO KNOW WHO
KILLED CLEVEDON KEEP
YOUR EYE ON THOYNE.

“That is No. 1,” Pepster said. “Here is No. 2.”


He handed me a second document, but this time it was a plain white
paper on which the ink had run rather badly, though the letters were
quite legible. It was, too, much shorter, simply reading:

THOYNE MURDERED CLEVEDON.


“Anonymous letters by some crank, who thinks he has made a
discovery,” I remarked.
“Yes,” Pepster agreed, “but here is No. 3.”
The third communication was written in red ink on a buff-coloured
slip of paper, such as Government offices use, and read:

YOU ARE MISSING YOUR


LIFE’S CHANCE. ARREST
THOYNE AND I WILL PRODUCE
THE EVIDENCE.
TRUST ME.

“Were they addressed to you personally?”


“Yes, and to my private address.”
“Apparently somebody who knows you.”
“Looks like it.”
“Come by post?”
“Yes.”
“Postmark?”
“Two Cartordale, the third Midlington. Now, is the writer merely a
crank, or has he something up his sleeve?”
“If you do nothing he’ll probably write again and may be more
explicit.”
“Well, of course, Thoyne is very deep in this thing, but there is
nothing definite connecting him with the murder—is there?”
But I merely shook my head vaguely at that. In this curious case one
never knew what a day might bring forth. The changes and
developments were as rapid as a cinema show.
CHAPTER XIX
THE HAIRPIN CLUE

In point of fact the first real clue I secured in this case consisted of
that hairpin I found on the floor of the lower cellar, though its bearing
on the mystery was not at first apparent. But it introduced me to a
new set of circumstances and took me a step or two on the road I
wished to travel. Until then I had been wandering round and round
in a circle. My first thought was that the hairpin belonged to Kitty
Clevedon and that she had deliberately deceived me when she
declared that she had not visited the cellar prior to conducting
Thoyne and myself thither. My suspicion was that she had been
there and that she had found and removed some traces of her
brother—that she was, in fact, still playing a game of bluff; though I
did not believe that this time Thoyne was in it. She was hoodwinking
him as well as myself.
I set a watch on the cellar beneath the ruined wing, making myself a
hiding-place by clearing out some of the furniture in one corner and
restacking it so as to leave a narrow passage in which I could
conceal myself if I wished. And I set little traps of a very simple
description, but sufficient to show me on my next visit that somebody
had been there in my absence and had penetrated to the lower
chamber by way of the swinging flagstone; but I was more than
astonished when during one of my periods, behind my little rampart,
I discovered that the visitor was not Kitty Clevedon at all, but—Nora
Lepley.
In all my imaginings my thoughts had never once turned to her. She
came in without faltering or hesitation, as one who knew her way
intimately, and swung open the trap-door, which she propped up by
means of a board. Then, taking the short ladder which I have
already mentioned, and which I knew by means of my little
arrangements had been used during my absence, she let it down,
and by it descended to the lower cellar.
As soon as her head had disappeared I crept to the opening on
hands and knees and saw her lift out a rough block of stone which
concealed a small opening not unlike a natural cupboard. Then she
took a small flash-lamp from the pocket of her big apron and sent a
beam of light into the hollow place, but situated as I was I could not
see whether she put anything in or took something out. For a minute
or two she stood pondering almost as if she were trying to make up
her mind on some doubtful point, then with a quick sigh she replaced
the lamp in her pocket and restored the stone.
I flitted back swiftly and noiselessly to my own corner whence I
watched her return from the lower depths, close down the stone and
lay the ladder along the wall, all with sedate, unhurried movements,
as one who had no reason to fear interruption. When she was quite
safely away, and I followed her to make sure, I went in my turn into
the lower cellar to investigate that little cupboard. It was evidently
her own private safe, containing all sorts of oddments a young girl
might hide away when she found too many prying eyes at home—a
bundle of letters, an envelope containing £20 in Treasury notes,
some oddments of jewellery and so on.
But what most attracted my attention, because they were in such
curious contrast with the rest of the collection, were a drinking-glass
and a small phial wrapped in white paper. I picked the latter up and
noticed a number of figures lightly pencilled on the wrapper arranged
in double column thus:

9.37 3.17
11.21 4.28
12.18 5.19
1.34 6.37
What they could mean I could not imagine, nor did I worry very long
about them. I removed the wrapper, to find inside a small phial
labelled “Pemberton’s Drops,” which were described as “a safe
remedy for headache, sleeplessness, and all nerve troubles.” The
dose was forty drops to be taken in water or other liquid. I turned the
bottle over and saw a circular, red label, not much larger than a
sixpence, on which was printed in small, white letters “Grainger,
Midlington”—obviously the chemist from whom Nora Lepley had
purchased her sleeping drug. I could well understand that she did
not want her friends to know that she took an hypnotic composition
of this character.
Almost without knowing what I was doing I removed the cork, and
then with a sudden jerk realised what it was I had stumbled upon. I
smelt the unmistakable odour of bitter almonds. Whatever the phial
had contained when Grainger of Midlington sold it to Nora Lepley, it
was nearly full now of a strong solution of hydrocyanic acid. I took
up the glass, but it was perfectly dry and odourless, despite which I
had no doubt that it had been the vehicle by which Sir Philip
Clevedon had taken the poison.
The real art and science of the detective lies in building up one fact
upon another until the edifice begins to assume intelligible shape. I
am far from saying that a Sherlock Holmes is impossible. On the
contrary, I have met people possessed as he was of a sense of
intuition almost as keen and certain as seeing and hearing in
ordinary men. But they are few. The average detective, though he
may indulge in theories, depends really on facts and is wise not to
wander very far from them. And he will find, if he is sufficiently
practised and astute, that facts breed facts, and that a clue, even if it
does not lead to the required solution, does often produce other
clues that continue the chain unbroken. A “clue” that leads nowhere
never was anything but a false clue from the beginning. And a
detective is largely dependent upon what ordinary folk describe as
luck or chance. His skill consists in making use of chance and in
missing nothing that luck brings him.
The police have, in addition to the natural astuteness of individuals,
the assistance of a singularly complete and effective organisation
that enables them to push their inquiries far and wide and, when they
have settled on their man, to weave round him a net from which
escape is all but impossible. By telegraph and telephone, the police
of the whole country can be put on the alert, descriptions can be
circulated in a few minutes, information conveyed and facts gathered
until the story is complete. The English police work under some
difficulty since the methods of questioning and even bullying that are
legal in France and are frequently permitted in America are rigidly
forbidden here. English law really does try to live up to the theory
that a man is innocent until he is proved guilty and that he must not
be trapped into any unwary admission. I do not mean to say that the
English police invariably abide by the strict letter of the law or always
observe it in spirit. There are occasions when it is worth while to
take risks. But, generally speaking, the law as it is and as it is
administered aids the criminal and hampers the police, despite
which, however, the latter are wonderfully successful.
Still, I can hear someone saying, many crimes go unpunished, many
criminals remain undiscovered. True, but one has to remember that
many criminals are known against whom there is no clear proof. The
conviction of a wrong-doer is a matter of evidence not of belief. I am
acquainted with two persons, one a man very well known in business
circles, the other a lady of great charm and important position, who, I
am quite sure, are murderers. The police are equally aware of the
fact. But so skilfully have the criminals covered every trace that
anything like proof would be wholly impossible.
And, again, it must not be forgotten that the criminal may be a
person of first-class education, alert mentally, intrepid, with money,
position and influence to aid him, and that he not only prepared the
ground before the crime without hindrance or suspicion but was able
to use his skill and resource in confusing the pursuit after it. A
burglar, jewel thief, or the like, may be a person of the Bill Sikes
variety, but he is quite as likely to be a University man with a
profession and income and a wide circle of friends.
When brains are pitted against brains it is a straight fight and the
best brains win quite irrespective of right or morality. The pursuit’s
most valuable and useful asset lies in the fact that most criminals
sooner or later make mistakes, and crime as a rule leaves no margin
for error. The alert detective misses nothing of that sort and loses no
opportunity his opponent may concede to him. But when all is said,
facts remain the detective’s chief stock-in-trade, and it is the
connected chain of established facts that eventually leads him to the
solution required and the person wanted.
So far, for example, in this Clevedon case I had been groping in the
dark, hanging grimly on to the few facts I had; and my blunderings
and stumblings had led me to that little phial of poison in Nora
Lepley’s secret hiding-place. I could not see yet the full bearing of
that discovery, but it was a new fact which I had reached simply by
following my nose.
Of course, I made a special journey into Midlington to look up
Grainger, the chemist, who, I learnt, had been in business in the city
about thirty-five years, was widely known, and very highly
respected. I made a small purchase, and noticed that there were
several bottles of Pemberton’s Drops in the large glass case that
was full of various proprietary medicines.
“Is that stuff any use for sleeplessness?” I asked, pointing to one of
the bottles.
“I don’t know,” he replied. “It seems fairly popular but I have never
tried it.”
“Is it dangerous to take?”
“I shouldn’t think so,” he replied, “though personally I should say that
all hypnotic drugs are better left alone. The preparation is a secret. I
do notice that people who take them come back for them, which
seems to suggest that they are effective.”
I went straight to Peakborough and interviewed Mr. Pepster.
“I’ve something I want you to do,” I said to him.
“Good! Is it important?”
“I think so. I fancy things are beginning to move.”
“I’m glad to hear it,” he retorted grimly. “As for me, I’m absolutely fed
up. The case is getting on my nerves. But what is it?”
“I want to know all there is to be known about Nora Lepley.”
“Yes?”
“And about Grainger, a Midlington chemist.”
“But what connection is there—?”
“I don’t know yet. I want to know. Probably there is none. But I
have traced prussic acid to Nora Lepley—”
“Gad!”
“And in a bottle that came from Grainger’s shop.”
“Good Lord!”
“Yes, it’s a queer development, isn’t it?”
“But—”
“I know absolutely nothing more than I have told you.”
Pepster nodded thoughtfully, then touched a bell.
“What is the next train for Midlington?” he asked of the police clerk
who answered his summons.
CHAPTER XX
STILL MORE ABOUT BILLY
CLEVEDON

And now I come to a very pretty and pleasant little adventure which
has its own place in the sequence of events. Only part of it came
under my own immediate observation; the rest I had to piece
together by adroit questioning and the aid of a little imagination.
It began with Kitty Clevedon, who, as she was crossing the park that
partly surrounds Hapforth House, was a little startled to see an
aeroplane coming rapidly to earth. It alighted only about sixty yards
away, and a young man jumped out and came towards her.
“Hallo! Kitty Clevedon, by all that’s lucky!” he cried. “I thought it was,
which was why I gave the order to come down.”
“Jimmy! but you are a stranger,” Kitty returned smilingly, as they
shook hands. “Are you still in the Air Service? I thought you had
been de—”
“Oh, yes, this is my own. I do it for fun now. Care to step aboard the
old bus and see what it is like?”
He helped her in and then gave some signal she did not
comprehend, and up they went.
“What are you doing?” Kitty demanded. “You have no right to take
—”
“None at all,” he admitted cheerfully. “But it would be a dull world if
we only did what we have a right to do, wouldn’t it?”
“You must let me get out, Jimmy,” she said, stamping her foot.
“I’m not stopping you,” he retorted, with a laugh, “but it’s a longish
step down to Mother Earth—about 600 feet, I should judge. Would
you like to have a look out? You are not frightened, are you? Have
you ever been up before?”
“Yes, twice,” she replied. “No, I’m not frightened—of the aeroplane.”
“Well, you’re not frightened of me, anyway,” he said. “I’m fierce, but
not frightful.”
He pulled back a leathern flap, disclosing an opening, through which
he thrust his head. “You ought to go in for flying, Kitty,” he went on.
“It’s the real sport—there’s nothing like it. Motoring is tame—and I
tell you what, I’ve a good mind to carry you off to see old Billy and
butt in on his honeymoon.”
“Billy!” she cried, turning on him suddenly. “Do you mean my
brother?”
“Here, steady on!” he said. “You’ll have the old bus over if you jolt us
like that.”
“You must put me down at once,” she went on. “I must see Mr. Holt
and Mr. Thoyne. Do you hear? At once.”
Jimmy Trevor saw that she was serious, and immediately gave the
order to descend.
“I’m awfully sorry, Kitty,” he said. “I was only—it was only a bit of a
joke. I would like to apologise, if you—”
“Don’t be an idiot,” Kitty replied sharply. “Only be quick, and don’t
talk until we are out.”
“But you will forgive—”
“Oh, yes, yes; and now don’t talk. Let me think.”
They made a safe landing, and Jimmy helped Kitty to alight.
“Now tell me,” she demanded, turning on him suddenly, “do you
know where my brother is?”
“Why, yes,” he replied, evidently a little mystified at her manner.
“And—and did you say—honeymoon? Is he—married?”
“Good Lord! didn’t you know?” he shouted. “Have I put my beastly
number nine foot into it again? He didn’t tell me it was a secret. I
was his best man, you know, and saw them off to Jersey for their
honeymoon. But he said nothing about keeping it secret. Didn’t you
know?”
“Will you come with me to see Mr. Holt?” Kitty asked.
“I will go anywhere you say, anywhere at once,” Jimmy replied.
Kitty started off immediately in the direction of the village, Jimmy
Trevor keeping pace with long strides, muttering apologies to her
and imprecations on himself at intervals. As they passed through
the big gates into the main road they met Thoyne, who glanced at
her companion a little questioningly. Jimmy Trevor was a very
personable youth, and jealousy is easily aroused.
“Oh, Ronald, this is Mr. Trevor,” Kitty said. “He—he knows where—
where Billy is.”
“The devil he does!” Thoyne cried. “And where is he?”
“He is”—she began to laugh a little hysterically, then pulled herself
up—“on his—his honeymoon.”
“His honeymoon!”
Thoyne stood stock still in the middle of the road and gazed, first at
Kitty and then at Jimmy Trevor, who grinned appreciatively.
“It seems to be news,” the latter said dryly. “Didn’t you know? Am I
making the first announcement? I seem to have created a sensation

You might also like