ISBN-10:
0672337452
ISBN-13:
9780672337451
Pub. Date:
08/19/2015
Publisher:
Sams
Visual Basic 2015 in 24 Hours, Sams Teach Yourself / Edition 1

Visual Basic 2015 in 24 Hours, Sams Teach Yourself / Edition 1

by James Foxall

Paperback

View All Available Formats & Editions
Current price is , Original price is $34.99. You
Select a Purchase Option
  • purchase options
    $29.44 $34.99 Save 16% Current price is $29.44, Original price is $34.99. You Save 16%.
  • purchase options

Product Details

ISBN-13: 9780672337451
Publisher: Sams
Publication date: 08/19/2015
Series: Sams Teach Yourself Series
Pages: 608
Sales rank: 554,423
Product dimensions: 7.00(w) x 9.10(h) x 1.40(d)

About the Author

James Foxall is President & CEO of Tigerpaw Software, a commercial software company providing complete business automation to more than 40,000 users in 28 countries in the IT/Networking, Telecommunications, Systems Integrator, Security, and Point of Sale industries. In his current role as President and CEO, James provides the vision and management to keep Tigerpaw focused on its customers and properly serving its markets.

James has a Masters degree in Business Administration and a BS degree in Management of Information Systems. Devoted to creating better businesses through technology, James has written 15 books, which have been published in over a dozen languages around the world. He is considered an authority on business process improvement and application interface and behavior standards of Windows applications, and serves the business community as an international speaker on automating business processes in the SMB environment.

Table of Contents

Introduction . . . . . . . . . . . . . xvii

Part I: The Visual Basic 2015 Environment

Hour 1: Jumping in with Both Feet: A Visual Basic 2015 Programming Tour . 1

Starting Visual Basic 2015 . . . . . . . . . . 2

Creating a New Project . . . . . . . . . . 3

Understanding the Visual Studio 2015 Environment . . . . . 6

Changing the Characteristics of Objects . . . . . . . 7

Adding Controls to a Form. . . . . . . . . 13

Designing an Interface . . . . . . . . . . 15

Writing the Code Behind an Interface. . . . . . . 20

Running a Project . . . . . . . . . . . 24

Summary . . . . . . . . . . . . 27

Q&A . . . . . . . . . . . . . 28

Workshop. . . . . . . . . . . . 28

Exercises. . . . . . . . . . . . . 29

Hour 2: Navigating Visual Basic 2015 . . . . . . . . 31

Using the Visual Basic 2015 Start Page . . . . . . . 31

Navigating and Customizing the Visual Basic Environment . . . 34

Working with Toolbars . . . . . . . . . . 40

Adding Controls to a Form Using the Toolbox . . . . . . 41

Setting Object Properties Using the Properties Window . . . . 43

Managing Projects . . . . . . . . . . . 50

A Quick-and-Dirty Programming Primer. . . . . . . 57

Getting Help. . . . . . . . . . . . 59

Summary . . . . . . . . . . . . 60

Q&A . . . . . . . . . . . . . 60

Workshop. . . . . . . . . . . . 61

Exercises. . . . . . . . . . . . . 61

Hour 3: Understanding Objects and Collections . . . . . . 63

Understanding Objects . . . . . . . . . . 64

Understanding Properties. . . . . . . . . . 64

Understanding Methods. . . . . . . . . . 72

Building a Simple Object Example Project . . . . . . . 73

Understanding Collections . . . . . . . . . 79

Using the Object Browser . . . . . . . . . . 82

Summary . . . . . . . . . . . . 84

Q&A . . . . . . . . . . . . . 84

Workshop. . . . . . . . . . . . 85

Exercises. . . . . . . . . . . . . 85

Hour 4: Understanding Events . . . . . . . . . . 87

Understanding Event-Driven Programming . . . . . . 87

Building an Event Example Project . . . . . . . . 97

Keeping Event Names Current . . . . . . . . 103

Summary . . . . . . . . . . . . 103

Q&A . . . . . . . . . . . . . 104

Workshop. . . . . . . . . . . . 104

Exercises. . . . . . . . . . . . 105

Part II: Building a User Interface

Hour 5: Building Forms: The Basics . . . . . . . . 107

Changing a Form’s Name . . . . . . . . . 108

Changing a Form’s Appearance . . . . . . . . 109

Showing and Hiding Forms . . . . . . . . . 122

Summary . . . . . . . . . . . . 128

Q&A . . . . . . . . . . . . . 128

Workshop. . . . . . . . . . . . 129

Exercises. . . . . . . . . . . . 130

Hour 6: Building Forms: Advanced Techniques . . . . . . 131

Working with Controls . . . . . . . . . . 131

Creating Topmost Nonmodal Windows. . . . . . . 151

Creating Transparent Forms . . . . . . . . . 151

Creating Scrollable Forms . . . . . . . . . 152

Creating MDI Forms . . . . . . . . . . 154

Setting the Startup Form . . . . . . . . . 158

Summary . . . . . . . . . . . . 159

Q&A . . . . . . . . . . . . . 160

Workshop. . . . . . . . . . . . 160

Exercises. . . . . . . . . . . . 161

Hour 7: Working with Traditional Controls . . . . . . . 163

Displaying Static Text with the Label Control. . . . . . 163

Allowing Users to Enter Text Using a Text Box. . . . . . 164

Creating Buttons. . . . . . . . . . . 172

Creating Containers and Groups of Option Buttons . . . . . 176

Displaying a List with the List Box . . . . . . . . 180

Creating Drop-Down Lists Using the Combo Box . . . . . 188

Summary . . . . . . . . . . . . 190

Q&A . . . . . . . . . . . . . 191

Workshop. . . . . . . . . . . . 191

Exercises. . . . . . . . . . . . 192

Hour 8: Using Advanced Controls. . . . . . . . . 193

Creating Timers . . . . . . . . . . . 193

Creating Tabbed Dialog Boxes . . . . . . . . 197

Storing Pictures in an Image List Control . . . . . . 200

Building Enhanced Lists Using the List View Control . . . . 202

Creating Hierarchical Lists Using the Tree View Control . . . . 207

Summary . . . . . . . . . . . . 211

Q&A . . . . . . . . . . . . . 212

Workshop. . . . . . . . . . . . 212

Exercises. . . . . . . . . . . . 213

Hour 9: Adding Menus and Toolbars to Forms . . . . . . 215

Building Menus . . . . . . . . . . . 215

Using the Toolbar Control . . . . . . . . . 229

Creating a Status Bar . . . . . . . . . . 235

Summary . . . . . . . . . . . . 237

Q&A . . . . . . . . . . . . . 237

Workshop. . . . . . . . . . . . 238

Exercises. . . . . . . . . . . . 238

Part III: Making Things Happen—Programming

Hour 10: Creating and Calling Code Procedures . . . . . . 239

Creating Visual Basic Code Modules . . . . . . . 239

Writing Code Procedures . . . . . . . . . 242

Calling Code Procedures . . . . . . . . . 248

Exiting Procedures. . . . . . . . . . . 254

Avoiding Infinite Recursion . . . . . . . . . 255

Summary . . . . . . . . . . . . 256

Q&A . . . . . . . . . . . . . 257

Workshop. . . . . . . . . . . . 257

Exercises. . . . . . . . . . . . 258

Hour 11: Using Constants, Data Types, Variables, and Arrays . . . . 259

Understanding Data Types. . . . . . . . . 260

Defining and Using Constants . . . . . . . . 263

Declaring and Referencing Variables . . . . . . . 266

Working with Arrays . . . . . . . . . . 273

Determining Scope . . . . . . . . . . 276

Declaring Variables of Static Scope . . . . . . . . 281

Using Variables in Your Picture Viewer Project. . . . . . 282

Renaming Variables . . . . . . . . . . 286

Summary . . . . . . . . . . . . 287

Q&A . . . . . . . . . . . . . 288

Workshop. . . . . . . . . . . . 288

Exercises. . . . . . . . . . . . 289

Hour 12: Performing Arithmetic, String Manipulation, and Date/Time Adjustments . .. 291

Performing Basic Arithmetic Operations with Visual Basic . . . 291

Comparing Equalities . . . . . . . . . . 295

Understanding Boolean Logic. . . . . . . . . 296

Manipulating Strings. . . . . . . . . . 298

Working with Dates and Times . . . . . . . . 304

Summary . . . . . . . . . . . . 309

Q&A . . . . . . . . . . . . . 310

Workshop. . . . . . . . . . . . 310

Exercises. . . . . . . . . . . . 311

Hour 13: Making Decisions in Visual Basic Code . . . . . . 313

Making Decisions Using If...Then. . . . . . . 313

Branching Within a Procedure Using GoTo . . . . . . 324

Summary . . . . . . . . . . . . 326

Q&A . . . . . . . . . . . . . 327

Workshop. . . . . . . . . . . . 327

Exercises. . . . . . . . . . . . 328

Hour 14: Looping for Efficiency . . . . . . . . . 329

Looping a Specific Number of Times Using For...Next . . . . 329

Using Do...Loop to Loop an Indeterminate Number of Times . . . 336

Summary . . . . . . . . . . . . 341

Q&A . . . . . . . . . . . . . 341

Workshop. . . . . . . . . . . . 342

Exercises. . . . . . . . . . . . 342

Hour 15: Debugging Your Code . . . . . . . . . 343

Adding Comments to Your Code . . . . . . . . 344

Identifying the Two Basic Types of Errors . . . . . . 346

Using Visual Basic’s Debugging Tools . . . . . . . 349

Breaking Only When a Condition Is Met. . . . . . . 358

Breaking Only When a Breakpoint Is Hit a Certain Number of Times . 359

Sending Messages to the Output Window Using Tracepoints. . . 360

Writing an Error Handler Using Try...Catch...Finally . . . 360

Summary . . . . . . . . . . . . 368

Q&A . . . . . . . . . . . . . 368

Workshop. . . . . . . . . . . . 368

Exercises. . . . . . . . . . . . 369

Hour 16: Designing Objects Using Classes . . . . . . . 371

Understanding Classes. . . . . . . . . . 372

Instantiating Objects from Classes . . . . . . . . 381

Summary . . . . . . . . . . . . 388

Q&A . . . . . . . . . . . . . 388

Workshop. . . . . . . . . . . . 388

Exercises. . . . . . . . . . . . 389

Hour 17: Interacting with Users . . . . . . . . . 391

Displaying Messages Using the MessageBox.Show() Function. . . 391

Creating Custom Dialog Boxes. . . . . . . . 398

Using InputBox() to Get Information from a User . . . . . 401

Interacting with the Keyboard . . . . . . . . 404

Using the Common Mouse Events . . . . . . . . 406

Summary . . . . . . . . . . . . 409

Q&A . . . . . . . . . . . . . 410

Workshop. . . . . . . . . . . . 410

Exercises. . . . . . . . . . . . 411

Hour 18: Working with Graphics . . . . . . . . . 413

Understanding the Graphics Object . . . . . . . 413

Working with Pens . . . . . . . . . . 416

Using System Colors . . . . . . . . . . 417

Working with Rectangles . . . . . . . . . 421

Drawing Shapes . . . . . . . . . . . 422

Drawing Text . . . . . . . . . . . 423

Persisting Graphics on a Form . . . . . . . . 425

Building a Graphics Project Example . . . . . . . 425

Summary . . . . . . . . . . . . 432

Q&A . . . . . . . . . . . . . 432

Workshop. . . . . . . . . . . . 432

Exercises. . . . . . . . . . . . 433

Part IV: Working with Data

Hour 19: Performing File Operations . . . . . . . . 435

Using the OpenFileDialog and SaveFileDialog Controls . . . 435

Manipulating Files with the File Object. . . . . . . 443

Manipulating Directories with the Directory Object . . . . 452

Summary . . . . . . . . . . . . 453

Q&A . . . . . . . . . . . . . 454

Workshop. . . . . . . . . . . . 454

Exercises. . . . . . . . . . . . 455

Hour 20: Working with the Registry and Text Files . . . . . . 457

Working with the Registry . . . . . . . . . 457

Reading and Writing Text Files . . . . . . . . 470

Summary . . . . . . . . . . . . 480

Q&A . . . . . . . . . . . . . 481

Workshop. . . . . . . . . . . . 481

Exercises. . . . . . . . . . . . 482

Hour 21: Working with a Database . . . . . . . . 483

Introducing ADO.NET . . . . . . . . . . 484

Manipulating Data . . . . . . . . . . 491

Summary . . . . . . . . . . . . 502

Q&A . . . . . . . . . . . . . 502

Workshop. . . . . . . . . . . . 503

Exercises. . . . . . . . . . . . 503

Hour 22: Printing . . . . . . . . . . . . 505

Preparing the Picture Viewer Project . . . . . . . 506

Printing and Previewing a Document . . . . . . . 509

Changing Printer and Page Settings . . . . . . . 519

Scaling Images to Fit a Page . . . . . . . . . 522

Summary . . . . . . . . . . . . 527

Q&A . . . . . . . . . . . . . 528

Workshop. . . . . . . . . . . . 528

Exercises. . . . . . . . . . . . 528

Hour 23: Sending Emails. . . . . . . . . . 529

Understanding the Classes Used to

Send Emails . . . . . . . . . . . . 530

Sending Email from Your Picture Viewer Application . . . . 530

Summary . . . . . . . . . . . . 543

Q&A . . . . . . . . . . . . . 544

Workshop. . . . . . . . . . . . 544

Exercises. . . . . . . . . . . . 544

Part V: Deploying Solutions and Beyond

Hour 24: Deploying Applications . . . . . . . . . 545

Understanding ClickOnce Technology. . . . . . . 545

Using the Publish Wizard to Create a ClickOnce Application . . . 547

Testing Your Picture Viewer ClickOnce Install Program . . . . 552

Uninstalling an Application You’ve Distributed . . . . . 553

Setting Advanced Options for Creating ClickOnce Programs. . . 556

Summary . . . . . . . . . . . . 557

Q&A . . . . . . . . . . . . . 557

Workshop. . . . . . . . . . . . 557

Exercises. . . . . . . . . . . . 558

Appendix A: The 10,000-Foot View . . . . . . . . 559

TOC, 9780672337451, 7/19/2015

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews