Nicht aus der Schweiz? Besuchen Sie lehmanns.de
Beginning Visual Basic 2012 - Bryan Newsome

Beginning Visual Basic 2012

(Autor)

Buch | Softcover
744 Seiten
2012
Wrox Press (Verlag)
978-1-118-31181-3 (ISBN)
CHF 57,65 inkl. MwSt
The ultimate beginner's guide to programming in Visual Basic 2012 Visual Basic, used to write Windows applications and web apps with ASP. NET, is an essential language for beginning programmers. Using the time-tested Wrox approach, this guide provides a step-by-step format that gets beginners up and running quickly and confidently.
The ultimate beginner's guide to programming in Visual Basic 2012 Visual Basic, used to write Windows applications and web apps with ASP.NET, is an essential language for beginning programmers. Using the time-tested Wrox approach, this guide provides a step-by-step format that gets beginners up and running quickly and confidently. Essential topics covered include writing Windows applications, working with dialog boxes and menus, object oriented programming techniques, programming for graphics, using Visual Basic with ASP.NET for web apps, and dealing with data access and SQL Server.



Visual Basic is a popular first language for beginning programmers; this Wrox beginner's guide covers all aspects of the newest version
Uses a basic, step-by-step approach to help beginners learn quickly and easily
Covers essential topics including flow control, data structure, writing Windows applications, error handling and debugging, objects and object oriented techniques, and class libraries
Explains Windows Forms, graphics programming, accessing databases, web programming using Visual Basic with ASP.NET, data access, SQL Server, ADO.NET, and XML

Beginning Visual Basic 2012 is a must-have for programming newcomers who want to get a solid footing in one of the most important programming languages.

Bryan Newsome works as a senior programmer and analyst specializing in Microsoft solutions. He provides clients with solutions and mentoring on leading-edge Microsoft technologies. Bryan is a Microsoft Certified Application Developer for VB.NET.

INTRODUCTION xxvii CHAPTER 1: WELCOME TO VISUAL BASIC 2012 1

Event-Driven Programming 2

Installing Visual Basic 2012 3

The Visual Studio 2012 IDE 6

The Profile Setup Page 6

The Menu 7

The Toolbars 8

Creating a Simple Application 9

Windows in the Visual Studio 2012 IDE 10

The Toolbox 14

Modified Hungarian Notation 17

The Code Editor 18

Using the Help System 23

Summary 23

CHAPTER 2: THE MICROSOFT .NET FRAMEWORK 27

Microsoft’s Reliance on Windows 28

MSN 1.0 28

The .NET Vision 29

This Sounds Like Java 30

Where Now? 30

Writing Software for Windows 31

The .NET Framework Classes 32

Executing Code 33

Common Language Runtime 34

Code Loading and Execution 35

Application Isolation 35

Security 35

Interoperability 36

Exception Handling 36

The Common Type System and Common Language Specification 37

Summary 37

CHAPTER 3: WRITING SOFTWARE 41

Information and Data 41

Algorithms 42

What Is a Programming Language? 43

Working with Variables 44

Comments and Whitespace 46

Comments 47

Whitespace 48

Data Types 49

Working with Numbers 49

Common Integer Math Operations 50

Integer Math Shorthand 52

The Problem with Integer Math 54

Floating-Point Math 54

Other States 56

Single-Precision Floating-Point Numbers 56

Working with Strings 57

Concatenation 58

Using the Concatenation Operator Inline 59

More String Operations 59

Substrings 61

Formatting Strings 62

Localized Formatting 63

Replacing Substrings 64

Using Dates 65

Formatting Date Strings 66

Extracting Date Properties 67

Date Constants 68

Defining Date Literals 69

Manipulating Dates 70

Boolean 71

Storing Variables 71

Binary 71

Bits and Bytes 72

Representing Values 73

Converting Values 74

Methods 76

Why Use Methods? 76

Methods You’ve Already Seen 77

Building a Method 80

Choosing Method Names 83

Scope 84

Summary 86

CHAPTER 4: CONTROLLING THE FLOW 89

Making Decisions 89

The If Statement 90

The Else Statement 92

Allowing Multiple Alternatives with ElseIf 92

Nested If Statements 94

Single-Line If Statement 94

Comparison Operators 94

Using Not Equal To 94

Using the Numeric Operators 96

The And and Or Operators 99

Using the And Operator 101

More on And and Or 102

String Comparison 103

Select Case 104

Case-Insensitive Select Case 108

Multiple Selections 110

The Case Else Statement 112

Different Data Types with Select Case 112

Loops 113

The For…Next Loop 113

Using the Step Keyword 116

Looping Backward 117

The For Each…Next Loop 118

The Do…Loop Loops 119

Do While…Loop 121

Acceptable Expressions for a Do…Loop 123

Other Versions of the Do…Loop 123

Nested Loops 124

Quitting Early 126

Quitting Do…Loops 128

Infinite Loops 129

Summary 130

CHAPTER 5: WORKING WITH DATA STRUCTURES 133

Understanding Arrays 134

Defining and Using Arrays 134

Using For Each…Next 137

Passing Arrays As Parameters 139

Sorting Arrays 141

Going Backward 142

Initializing Arrays with Values 144

Understanding Enumerations 145

Using Enumerations 145

Determining the State 149

Setting Invalid Values 151

Understanding Constants 152

Using Constants 152

Different Constant Types 154

Structures 155

Building Structures 155

Adding Properties to Structures 158

Working with ArrayLists 159

Using an ArrayList 159

Deleting from an ArrayList 163

Showing Items in the ArrayList 166

Working with Collections 167

Creating CustomerCollection 168

Adding an Item Property 170

Building Lookup Tables with Hashtable 171

Using Hashtables 172

Cleaning Up: Remove, RemoveAt, and Clear 175

Case Sensitivity 177

Advanced Array Manipulation 179

Dynamic Arrays 179

Using Preserve 181

Summary 182

CHAPTER 6: EXTENSIBLE APPLICATION MARKUP LANGUAGE (XAML) 185

What Is XAML? 186

XAML Syntax 187

Windows Presentation Foundation 190

Creating a Rich WPF User Interface 191

Using WPF Common Controls 197

Wiring Up Events 201

Summary 205

CHAPTER 7: BUILDING WINDOWS APPLICATIONS 209

Responding to Events 210

Building a Simple Application 217

Counting Characters 221

Counting Words 223

Creating More Complex Applications 229

Creating the Toolbar 231

Creating the Status Bar 235

Creating an Edit Box 237

Clearing the Edit Box 239

Responding to Toolbar Buttons 242

Using Multiple Forms 247

About Dialog 247

Summary 251

CHAPTER 8: DISPLAYING DIALOGS 255

The MessageBox 256

Available Icons for MessageBox 256

Available Buttons for MessageBox 257

Setting the Default Button 257

Miscellaneous Options 258

The Show Method Syntax 258

Example Message Boxes 260

The OpenFileDialog Control 263

The OpenFileDialog Control 264

The Properties of OpenFileDialog 265

OpenFileDialog Methods 266

Using the OpenFileDialog Control 266

The SaveDialog Control 271

The Properties of SaveFileDialog 271

SaveFileDialog Methods 273

Using the SaveFileDialog Control 273

The FontDialog Control 276

The Properties of FontDialog 277

The Methods of FontDialog 277

Using the FontDialog Control 277

The ColorDialog Control 280

The Properties of ColorDialog 281

Using the ColorDialog Control 282

The PrintDialog Control 283

The Properties of PrintDialog 284

Using the PrintDialog Control 285

The PrintDocument Class 285

The Properties of the PrintDocument Class 285

Printing a Document 285

The FolderBrowserDialog Control 292

The Properties of FolderBrowserDialog 292

Using the FolderBrowserDialog Control 293

Summary 296

CHAPTER 9: CREATING MENUS 299

Understanding Menu Features 299

Images 300

Access Keys 300

Shortcut Keys 300

Check Marks 300

The Properties Window 301

Creating Menus 302

Designing the Menus 302

Adding Toolbars and Controls 304

Coding Menus 306

Coding the View Menu and Toolbars 310

Testing Your Code 311

Context Menus 314

Creating Context Menus 315

Enabling and Disabling Menu Items and Toolbar Buttons 318

Summary 321

CHAPTER 10: DEBUGGING AND ERROR HANDLING 325

Major Error Types 326

Syntax Errors 326

Execution Errors 330

Logic Errors 330

Debugging 331

Creating a Sample Project 332

Setting Breakpoints 348

Debugging Using the Watch Window and QuickWatch Dialog Box 356

Debugging with the Autos Window 358

Debugging with the Locals Window 358

Error Handling 360

Using Structured Error Handling 361

Summary 363

CHAPTER 11: BUILDING OBJECTS 367

Understanding Objects 368

Encapsulation 369

Methods and Properties 369

Events 370

Visibility 370

What Is a Class? 371

Building Classes 371

Reusability 372

Designing an Object 373

State 374

Behavior 374

Storing State 375

Real Properties 378

Read/Write Properties 381

Auto-Implemented Properties 384

The IsMoving Method 384

Constructors 386

Inheritance 388

Adding New Methods and Properties 389

Adding a GetPowerToWeightRatio Method 392

Changing Defaults 394

Polymorphism: Scary Word, Simple Concept 395

Overriding More Methods 396

Inheriting from the Object Class 398

Objects and Structures 399

The Framework Classes 399

Namespaces 399

The Imports Statement 402

Creating Your Own Namespace 402

Inheritance in the .NET Framework 406

Summary 407

CHAPTER 12: ADVANCED OBJECT-ORIENTED TECHNIQUES 409

Building a Favorites Viewer 410

Internet Shortcuts and Favorites 410

Using Classes 412

Scanning Favorites 418

Viewing Favorites 426

An Alternative Favorite Viewer 428

Building a Favorites Tray 428

Displaying Favorites 429

Using Shared Properties and Methods 433

Using Shared Properties 434

Using Shared Methods 438

Understanding Object-Oriented Programming and Memory Management 439

Garbage Collection 440

Releasing Resources 441

Defragmentation and Compaction 442

Summary 443

CHAPTER 13: BUILDING CLASS LIBRARIES 445

Understanding Class Libraries 446

Creating a Class Library 446

Building a Class Library for Favorites Viewer 448

A Multitiered Application 452

Using Strong Names 453

Signing Assemblies 453

Assembly Versions 456

Registering Assemblies 456

Gacutil Utility 457

Why Is My Assembly Not Visible in the References Dialog? 457

Designing Class Libraries 457

Using Third-Party Class Libraries 459

Viewing Classes with the Object Browser 460

Summary 461

CHAPTER 14: CREATING WINDOWS FORMS USER CONTROLS 463

Windows Forms Controls 464

Creating and Testing a User Control 464

Exposing Properties from User Controls 468

Adding Properties 468

Exposing Methods from User Controls 470

Exposing Events from User Controls 471

Design Time or Runtime 476

Creating a Command Link Control 478

Building the Command Link Control 479

Using the Command Link Control 487

Summary 490

CHAPTER 15: ACCESSING DATA USING STRUCTURED QUERY LANGUAGE 493

What You Need to Complete This Chapter’s Exercises 494

What Is a Database? 495

Database Tables 495

Primary and Foreign Keys 500

Understanding Primary Keys 500

Understanding Foreign Keys 501

Queries 502

Understanding Basic SQL Syntax 503

Using SELECT Statement 503

Using the JOIN Statement 504

Using the UPDATE Statement 505

Using the DELETE Statement 506

Using the INSERT Statement 507

Using the SQL Comment 508

Executing Queries in SQL Server 508

Summary 511

CHAPTER 16: DATABASE PROGRAMMING WITH SQL SERVER AND ADO.NET 515

ADO.NET 516

ADO.NET Data Namespaces 516

The SqlConnection Class 517

Working with the Connection String Parameters 518

Opening and Closing the Connection 519

The SqlCommand Class 519

The Connection Property 520

The CommandText Property 520

The Parameters Collection 520

The ExecuteNonQuery Method 521

The SqlDataAdapter Class 522

The SelectCommand Property 522

Setting SelectCommand to SQL Text 523

Setting SelectCommand to a Stored Procedure 523

Using Command Builders to Create the Other Commands 524

The Fill Method 524

The DataSet Class 526

DataView 526

The Sort Property 527

The RowFilter Property 527

The Find Method 528

The ADO.NET Classes in Action 528

Data Binding 537

BindingContext and CurrencyManager 538

Binding Controls 539

Binding Examples 539

Summary 567

CHAPTER 17: DYNAMIC DATA WEBSITE 571

Creating a Dynamic Data Entities Website 571

Customizing the Design of a Dynamic Data Website 577

Page Templates 578

Entity Templates 578

Field Templates 578

Filter Templates 579

Summary 583

CHAPTER 18: ASP.NET 587

Thin-Client Architecture 588

Web Forms versus Windows Forms 589

Windows Forms Advantages 589

Web Forms Advantages 589

Web Applications: The Basic Pieces 590

Web Servers 590

Browsers 590

HyperText Markup Language 591

JavaScript 591

Cascading Style Sheets 591

Active Server Pages 592

Benefits of ASP.NET Web Pages 592

Special Website Files 592

Global.asax 592

Web.config 592

Development 593

Controls: The Toolbox 593

Building Websites 593

Creating a Web Form for Client- and Server-Side Processing 594

Website Locations with VS 2012 599

Performing Data Entry and Validation 602

Site Layout, Themes, and Navigation 606

Using the GridView to Build a Data-Driven Web Form 611

Summary 616

CHAPTER 19: DEPLOYING YOUR APPLICATION 619

What Is Deployment? 620

ClickOnce Deployment 620

XCOPY Deployment 626

Creating a Visual Studio 2012 Setup Application 626

Customize the User Interface 632

Deploying Diff erent Solutions 633

Private Assemblies 633

Shared Assemblies 634

Deploying Desktop Applications 635

Deploying Web Applications 635

Deploying XML Web Services 635

Useful Tools 635

Summary 636

CHAPTER 20: WINDOWS 8 APPS 639

Windows 8 Application Design Principles 640

Using Touch 640

Application Commands 640

Windows 8 Controls 642

Creating your First Windows 8 App 643

Application Layout 655

Application Views 656

Screen Sizes and Orientation 656

Summary 661

APPENDIX A: EXERCISE SOLUTIONS 665

APPENDIX B: WHERE TO NOW? 679

INDEX 683

Erscheint lt. Verlag 19.9.2012
Sprache englisch
Maße 183 x 234 mm
Gewicht 1247 g
Themenwelt Informatik Programmiersprachen / -werkzeuge Visual Basic
Schlagworte Visual Basic 2012
ISBN-10 1-118-31181-7 / 1118311817
ISBN-13 978-1-118-31181-3 / 9781118311813
Zustand Neuware
Haben Sie eine Frage zum Produkt?
Mehr entdecken
aus dem Bereich