Beginning Visual Basic 2015
Wrox Press (Verlag)
978-1-119-09211-7 (ISBN)
Learn Visual Basic step by step and start programming right away Beginning Visual Basic 2015 is the ideal guide for new programmers, especially those learning their first language. This new edition has been updated to align with Visual Studio 2015, and also refocused to concentrate on key beginner topics. Precise, step-by-step instructions walk you through important tasks, and clear explanations targeted to beginners will have you writing your first Visual Basic application quickly. You'll start from the absolute beginning, assuming no prior programming experience, and then gradually build your skills to write Visual Basic applications for Windows and the Web. Coverage includes objects, class libraries, graphics, databases, and much more, with explicit instructions on using ASP.NET, SQL Server, ADO.NET, and XML.
Visual Studio is the usual environment for Visual Basic programming, and the latest upgrade has made Visual Basic more feature compatible with C# to allow programmers to move fluidly between the two languages. Don't know C#? Don't worry! This book starts from the very beginning of Visual Basic programming to help you build your skills from the ground-up.
Understand flow control and data structure
Debug Windows applications, dialog boxes, and menus
Master objects and object-oriented techniques
Access databases, program graphics, and program for the Web
Over three million programmers use Visual Basic, and many of them learned it as their first language. It's beginner-friendly, versatile, and visually oriented, making it an ideal introduction to the programming mindset, workflow, and hard skills. Beginning Visual Basic 2015 gets you started on the right foot, with clear, patient instruction and plenty of hands-on practice.
About the author Bryan Newsome is a senior programmer/analyst and a Microsoft Certified Application Developer for VB.NET. Since starting his career with Visual Basic 5, he has embraced each new version and now creates all new applications leveraging the .NET platform and VB.NET. Bryan has built a reputation around providing solutions and mentoring on leading-edge Microsoft technologies. Visit us at wrox.com where you have access to free code samples, Programmer to Programmer forums, and discussions on the latest happenings in the industry from around the world.
INTRODUCTION xxvii CHAPTER 1: WELCOME TO VISUAL BASIC 2015 1
Implementing Event-Driven Programming 2
Installing Visual Basic 2015 3
The Visual Studio 2015 IDE 5
The Profi le Setup Page 5
The Menu 6
The Toolbars 8
Creating a Simple Application 9
Windows in the Visual Studio 2015 IDE 10
Modifi ed Hungarian Notation 17
The Code Editor 18
Using the Help System 22
Summary 23
CHAPTER 2: THE MICROSOFT .NET FRAMEWORK 25
The .NET Vision 25
This Sounds Like Java 26
Where Now? 27
Writing Software for Windows 27
The .NET Framework Classes 28
Executing Code 30
Common Language Runtime 31
Code Loading and Execution 31
Application Isolation 31
Security 32
Interoperability 33
Exception Handling 33
The Common Type System and Common Language Specification 33
Summary 34
CHAPTER 3: WRITING SOFTWARE 37
Information and Data 37
Algorithms 38
What Is a Programming Language? 39
Working with Variables 40
Comments and Whitespace 43
Comments 43
Whitespace 45
Data Types 45
Working with Numbers 45
Common Integer Math Operations 46
Integer Math Shorthand 49
The Problem with Integer Math 50
Floating-Point Math 50
Working with Strings 53
Using Dates 62
Boolean 69
Storing Variables 69
Binary 69
Bits and Bytes 70
Representing Values 70
Converting Values 72
Methods 74
Why Use Methods? 74
Methods You’ve Already Seen 75
Building a Method 78
Choosing Method Names 81
Scope 82
Summary 84
CHAPTER 4: CONTROLLING THE FLOW 87
Making Decisions 87
The If Statement 88
The Else Statement 90
Allowing Multiple Alternatives with ElseIf 90
Nested If Statements 92
Single-Line If Statement 92
Comparison Operators 92
String Comparison 101
Select Case 102
Case-Insensitive Select Case 106
Multiple Selections 108
The Case Else Statement 109
Different Data Types with Select Case 110
Loops 110
The For...Next Loop 110
The Do...Loop Loops 116
Nested Loops 120
Quitting Early 121
Quitting Do...Loops 123
Infinite Loops 124
Summary 125
CHAPTER 5: WORKING WITH DATA STRUCTURES 127
Understanding Arrays 128
Defining and Using Arrays 128
Using For Each...Next 131
Passing Arrays as Parameters 133
Sorting Arrays 136
Going Backward 137
Initializing Arrays with Values 138
Understanding Enumerations 139
Using Enumerations 140
Determining the State 143
Setting Invalid Values 146
Understanding Constants 146
Using Constants 146
Different Constant Types 148
Structures 148
Building Structures 149
Adding Properties to Structures 152
Working with ArrayLists 153
Using an ArrayList 153
Deleting from an ArrayList 158
Showing Items in the ArrayList 161
Working with Collections 162
Creating CustomerCollection 163
Adding an Item Property 164
Building Lookup Tables with Hashtable 166
Using Hashtables 166
Cleaning Up: Remove, RemoveAt, and Clear 169
Case Sensitivity 172
Advanced Array Manipulation 173
Dynamic Arrays 173
Using Preserve 175
Summary 176
CHAPTER 6: BUILDING WINDOWS APPLICATIONS 179
Responding to Events 180
Counting Characters 184
Counting Words 188
Creating More Complex Applications 191
Creating the Toolbar 192
Creating the Status Bar 195
Creating an Edit Box 196
Clearing the Edit Box 197
Responding to Toolbar Buttons 199
Using Multiple Forms 202
About Dialog 202
Summary 206
CHAPTER 7: DISPLAYING DIALOGS 209
The MessageBox 210
Available Icons for MessageBox 210
Available Buttons for MessageBox 211
Setting the Default Button 211
Miscellaneous Options 212
The Show Method Syntax 212
Example Message Boxes 214
The OpenFileDialog Control 218
The OpenFileDialog Control 218
The Properties of OpenFileDialog 218
OpenFileDialog Methods 220
Using the OpenFileDialog Control 221
The SaveDialog Control 226
The Properties of SaveFileDialog 226
SaveFileDialog Methods 227
Using the SaveFileDialog Control 227
The FontDialog Control 231
The Properties of FontDialog 231
The Methods of FontDialog 232
Using the FontDialog Control 232
The ColorDialog Control 235
The Properties of ColorDialog 236
Using the ColorDialog Control 237
The PrintDialog Control 238
The Properties of PrintDialog 239
Using the PrintDialog Control 240
The PrintDocument Class 240
The Properties of the PrintDocument Class 240
Printing a Document 241
The FolderBrowserDialog Control 248
The Properties of FolderBrowserDialog 248
Using the FolderBrowserDialog Control 249
Summary 252
CHAPTER 8: CREATING MENUS 255
Understanding Menu Features 255
Images 256
Access Keys 256
Shortcut Keys 256
Check Marks 256
The Properties Window 257
Creating Menus 259
Designing the Menus 259
Adding Toolbars and Controls 261
Coding Menus 263
Coding the View Menu and Toolbars 267
Testing Your Code 269
Context Menus 272
Creating Context Menus 272
Enabling and Disabling Menu Items and Toolbar Buttons 275
Summary 279
CHAPTER 9: DEBUGGING AND ERROR HANDLING 283
Major Error Types 284
Syntax Errors 284
Execution Errors 288
Logic Errors 288
Debugging 289
Creating a Sample Project 289
Setting Breakpoints 306
Debugging Using the Watch Window and QuickWatch Dialog Box 313
Debugging with the Autos Window 316
Debugging with the Locals Window 316
Error Handling 318
Using Structured Error Handling 319
Summary 321
CHAPTER 10: BUILDING OBJECTS 325
Understanding Objects 326
Encapsulation 327
Methods and Properties 327
Events 328
Visibility 328
What Is a Class? 329
Building Classes 330
Reusability 330
Designing an Object 332
State 332
Behavior 333
Storing State 333
Real Properties 336
Read/Write Properties 339
Auto-Implemented Properties 342
The IsMoving Method 343
Constructors 345
Inheritance 346
Adding New Methods and Properties 348
Adding a GetPowerToWeightRatio Method 350
Changing Defaults 352
Polymorphism: Scary Word, Simple Concept 354
Overriding More Methods 354
Inheriting from the Object Class 356
Objects and Structures 357
The Framework Classes 357
Namespaces 358
The Imports Statement 360
Creating Your Own Namespace 361
Inheritance in the .NET Framework 364
Summary 365
CHAPTER 11: ADVANCED OBJECT-ORIENTED TECHNIQUES 367
Building a Favorites Viewer 368
Internet Shortcuts and Favorites 368
Using Classes 371
Scanning Favorites 377
Viewing Favorites 384
An Alternative Favorite Viewer 386
Building a Favorites Tray 387
Displaying Favorites 388
Using Shared Properties and Methods 392
Using Shared Properties 392
Using Shared Methods 397
Understanding Object-Oriented Programming and Memory Management 398
Garbage Collection 400
Releasing Resources 400
Defragmentation and Compaction 401
Summary 402
CHAPTER 12: ACCESSING DATA USING STRUCTURED QUERY LANGUAGE 405
What You Need to Complete This Chapter’s Exercises 406
What Is a Database? 407
Database Tables 407
Primary and Foreign Keys 413
Queries 415
Understanding Basic SQL Syntax 415
Using SELECT Statement 416
Using the JOIN Statement 417
Using the UPDATE Statement 419
Using the DELETE Statement 419
Using the INSERT Statement 420
Using the SQL Comment 421
Executing Queries in SQL Server 421
Summary 425
CHAPTER 13: DATABASE PROGRAMMING WITH SQL SERVER AND ADO.NET 427
ADO.NET 428
ADO.NET Data Namespaces 428
The SqlConnection Class 429
Working with the Connection String Parameters 430
Opening and Closing the Connection 431
The SqlCommand Class 431
The SqlDataAdapter Class 434
The DataSet Class 438
DataView 438
The ADO.NET Classes in Action 440
Data Binding 450
BindingContext and CurrencyManager 450
Binding Controls 451
Binding Examples 452
Summary 480
CHAPTER 14: ASP.NET 483
Thin]Client Architecture 484
Web Forms versus Windows Forms 485
Windows Forms Advantages 485
Web Forms Advantages 485
Web Applications: The Basic Pieces 486
Web Servers 486
Browsers 486
HyperText Markup Language 487
JavaScript 487
Cascading Style Sheets 487
Active Server Pages 488
Benefits of ASP.NET Web Pages 488
Special Website Files 488
Development 489
Controls: The Toolbox 489
Building Websites 490
Creating a Web Form for Client] and Server]Side Processing 490
Website Locations with VS 2015 495
Performing Data Entry and Validation 498
Using the GridView to Build a Data]Driven Web Form 507
Summary 512
CHAPTER 15: DEPLOYING YOUR APPLICATION 515
What Is Deployment? 516
ClickOnce Deployment 516
XCOPY Deployment 521
Visual Studio 2015 Setup Application Options 522
Deploying Different Solutions 522
Private Assemblies 523
Shared Assemblies 523
Deploying Desktop Applications 524
Deploying Web Applications 524
Deploying XML Web Services 524
Useful Tools 525
Summary 525
CHAPTER 16: WINDOWS 8 APPS 529
Windows 8 Application Design Principles 530
Using Touch 530
Application Commands 531
Windows 8 Controls 532
Coding Windows 8 Apps with XAML 533
Creating Your First Windows 8 App 534
Application Layout 548
Application Views 548
Screen Sizes and Orientation 548
Summary 553
APPENDIX: EXERCISE SOLUTIONS 557
INDEX 569
Erscheint lt. Verlag | 5.1.2016 |
---|---|
Sprache | englisch |
Maße | 188 x 234 mm |
Gewicht | 1066 g |
Themenwelt | Informatik ► Programmiersprachen / -werkzeuge ► Visual Basic |
Informatik ► Software Entwicklung ► Objektorientierung | |
ISBN-10 | 1-119-09211-6 / 1119092116 |
ISBN-13 | 978-1-119-09211-7 / 9781119092117 |
Zustand | Neuware |
Haben Sie eine Frage zum Produkt? |
aus dem Bereich