A gift for blood "A programmers Introduction to Visual Basic.NET"

Source: Internet
Author: User
Tags building windows error handling garbage collection inheritance web services client
Visual Overview
Foreword VIII
Introduction 1
1 Why Should to Visual Basic.NET? 3
2 Your vb.net application 21
3 Major vb.net Changes 49
4 building Classes and assemblies with vb.net 73
5 Inheritance with vb.net 91
6 Database Access with vb.net and Ado.net 105
7 Building Web applications with vb.net and ASP.net 133
8 Building Web Services with vb.net 153
9 Building Windows Services with vb.net 165
Upgrading VB6 Projects to vb.net 175
A the Common Language specification 187
Index 191
Contents
INTRODUCTION 1
1 WHY SHOULD to VISUAL Basic.NET? 3
Visual basic.net:a the New Framework ... ..... ..... ..... ...... ..... ..... ..... ..... ..... ...... ..... ... 3
The Common Language Runtime ......... ....... .................................. ................ ........ 6
Managed Execution ....... ....... ...... ..... ..... ..... ..... ............. ....... ....... ....... ... 8
Microsoft Intermediate Language (MSIL) ....... ...... ...... ...... ...... ..... ... 8
The Just-In-Time Compiler .............................. ... ................ ........ ... 9
Executing Code ... ....... ...... ...... ..... ...... ..... ..... .......... ....... ....... ...... ...... ... 9
Assemblies ..... ....... ...... ........ ...... ...... ..... ... .......... ....... ....... ...... ...... ..... ... 10
The Common Type System ... .......... ............. ............... ....... ....... 12
Classes ..... ...... ...... ..... ...... ....... ...... ....... ... ........ ....... ...... ...... ..... ..... ..... ...... ... 13
Interfaces ..... ....... ...... ........ ...... ...... ..... ... .......... ....... ....... ...... ...... ...... ... 13
Value Types ... ........ ...... ..... ...... ..... ...... ..... ... .......... ....... ....... ....... ....... ... 14
Delegates ..... ....... ...... ........ ...... ...... ..... ... .......... ....... ....... ...... ...... ...... ... 14
The. NET Framework Class Library ..., ..... .... .... .... .... .... .... .... .... .... .... .... ...., ... and .... ..... 14
self-describing components .......... ....... ..... ..... .... ... ................. ........ 15
Cross-language interoperability ..... ....... ..... ..... ..... ..... ..... ..... ..... ..... ...... ..... ..... ... 16
The Catch ....... ..... ..... ..... ..... ...... ...... ....... ... .......... ....... ....... ...... ...... ...... ... 17
Security ... ..... ...... ..... ..... ...... ..... ..... ..... ..... ..... ... ..... ....... ....... ..... ..... ...... ..... ..... ...... ... 17
Code Access Security (CAS) ......... ............ ................. ........ 18
Role-based security ..... ...... ...... ..... ..... ..... ..... ... ............... ....... ....... ... 18
Summary ..... ...... ...... ...... ..... ...... ....... ....... ... ..... ....... ...... ...... ..... ...... ...... ..... ..... ... 18
2 YOUR vb.net application 21
The Start Page ... ..... ....... ...... ...... ....... ....... ... .......... ....... ....... ...... ...... ...... ... 21st
Creating a New Project ...... .................... ... ............. ...... ....... ....... ... 23
Examining the IDE ............ ............... ............. ...... ....... ....... ... 25
Creating Your the VB.net application ........ ...... ..... ..... ..... ..... ..... ..... ..... ..... .... ... 31
Windows Application Enhancements ... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ... 36
Resizing Controls automatically ....... ...... ...... ..... ..... ..... ..... ..... ..... ...... ..... ... 36
Anchoring Controls to the Form Edges ...... .......... ....... ....... ....... ... 38
Easier Menus ....... ....... ..... ..... ...... ..... ...... ... ........... ....... ...... ....... ...... ... 41
Setting Tab order ...... ..... ..... ...... ..... ..... ..... ... ............. ....... ...... ....... ... 42
Line and Shape controls:you ' re outta ..... ................... ... 44
Form Opacity ... ....... ...... ..... ...... ...... ..... ..... ... ........... ....... ...... ....... ...... ... 45
Summary ..... ...... ...... ...... ..... ...... ....... ....... ... ..... ....... ...... ...... ..... ...... ...... ..... ..... ... 48
3 MAJOR vb.net CHANGES 49
General Changes ... ........ ...... ....... ....... ........ ... ........... ....... ...... ....... ...... ... 49
Default Properties ... ..... ..... ..... ..... ...... ..... ...... ... ............. ...... ....... ....... ... 49
Subs and Functions Require parentheses ......... ...... ...... ..... ...... ..... ... 50
Changes to Boolean Operators ..... ...... ...... ...... ...... ...... ....... ...... ....... ..... ... 51
Declaration Changes ........ ...... ...... ..... ..... ..... ... ............... ....... ....... ... 52
Support for New assignment Operators ..... ........ ....... ...... ...... ....... ... 52
ByVal is now the Default ... .................. ... ............... ....... ....... 53
Block-level ...... ....... ....... ...... ........ ... ............... ....... ....... ... 53
While ... Wend becomes while ... End While ... ........ ..... ........ ....... ... 54
Procedure Changes ....... ....... ...... ..... ..... ..... ... ............... ....... ....... ... 54
Array Changes ... ...... ..... ..... ..... ..... ...... ..... ..... .......... ....... ....... ...... ...... ... 57
Option Strict ... ........ ....... ....... ........... ... .......... ....... ....... ...... ...... ... 58
Data Type Changes ... ....... ..... ...... ..... ...... ..... ............. ...... ....... ....... ... 59
Structured Error handling ............ ............ ................ ........ ... 62
Structures Replace UDTs .................. ..... ... ................ ........ ... 64
IDE Changes ... ....... ...... ..... ...... ...... ..... ..... ... ........... ....... ...... ....... ...... ... 66
New Items ... ..... ..... ...... ..... ..... ..... ..... ..... ..... ..... ... ........ ....... ...... ...... ..... ..... ..... ...... ... 66
Constructors and destructors ................... ............... ........ 66
Namespaces ..... ....... ....... ....... ...... ........ ... .......... ....... ....... ....... ....... ... 67
Inheritance ..... ....... ...... ........ ...... ...... ..... ... .......... ....... ....... ...... ...... ..... ... 69
Overloading ..... ....... ....... ....... ...... ........ ... .......... ....... ....... ....... ....... ... 69
Free Threading ...... ....... ...... ...... ...... ....... ... .......... ....... ....... ...... ...... ... 70
Garbage Collection ....... ....... ...... ..... ..... ..... ... ............... ....... ....... ... 72
Summary ..... ...... ...... ...... ..... ...... ....... ....... ... ..... ....... ...... ...... ..... ...... ...... ..... ..... ... 72
4 building CLASSES and assemblies with vb.net 73
Creating Your the Class I .................. ................ ........ 74
Adding a "souped-up" Class ................. ................ ........ 74
Creating Properties ... ........ ...... ....... ...... ..... ... ............... ....... ....... ... 75
Building a Test Client ..... .............. ........ ... ............... ....... ....... ... 76
Read-only and Write-only Properties ... ....... ....... ....... ....... ...... ....... ... 79
Parameterized Properties ... ....... ....... ....... ...... ... ................ ........ ... 79
Default Properties ... ..... ..... ..... ..... ...... ..... ...... ... ............. ...... ....... ....... ... 80
Constructors in Your Classes ............. ........ ................ ........ 80
Classes without constructors .......... ....... .........----------............... ........ 81
Adding Methods to Classes ................ ....... ................. ........ 82
Adding Events ... ..... ....... ...... ..... ...... ..... ..... ... .......... ....... ....... ...... ...... ... 82
The "Final" Code ..... ..... ..... ....... ..... ...... ..... ... .......... ....... ....... ....... ....... ... 84
Compiling the Assembly ......................... ............... ....... ....... ... 86
Reusing the Assembly in other applications ...................... ... 87
How. NET locates Assemblies ... ..... ....... ...... ..... ...... ...... ....... ...... ..... ..... ... 88
Summary ..... ...... ...... ...... ..... ...... ....... ....... ... ..... ....... ...... ...... ..... ...... ...... ..... ..... ... 90
5 Inheritance with vb.net 91
What is inheritance? .............................................................................. 91
Interface inheritance in VB6 .................. ... ................ ........ 92
Vb. NET ' s implementation inheritance ..... ........ ....... ...... ...... ...... ..... ... 93
A Quick inheritance Example ......... .............. ................. ........ 94
Shared members ... ..... ..... ..... ..... ..... ...... ...... ..... ... ........... ....... ...... ....... ...... ... 95
Inheritance Keywords ....... ....... ..... ..... ..... ..... ..... ............. ...... ....... ....... ... 96
Forcing or preventing inheritance ... ....... ....... ...... ...... ....... ...... ...... ....... ... 96
overriding Properties and Methods ... ....... ....... ....... ....... ........ ....... ... 97
Polymorphism ..... ....... ...... ........ ...... ...... ..... ... .......... ....... ....... ...... ...... ..... ... 99
Polymorphism with inheritance ..... ....... ...... ...... ...... ....... ..... ..... ..... ..... ... 100
Polymorphism with interfaces ..... ....... ...... ...... ...... ..... ....... ..... ..... ....... ... 101
When ' to ' use and ' not ' to ' use inheritance ................ 102
Summary ..... ...... ...... ..... ...... ....... ...... ....... ... ........ ....... ...... ...... ..... ..... ..... ...... ... 103
6 DATABASE ACCESS with vb.net and Ado.net 105
Accessing a Database from Windows application ................. 106
Using the DataAdapter Configuration Wizard ........... .......... ... 107
ado.net............................................................................................122
About ado.net............................................................................122
Datasets ..... ....... ...... ........ ...... ...... ..... ... .......... ....... ....... ...... ...... ...... ... 122
Working with the Ado.net Objects ............ ......... ....... ....... ..... 123
XML integration ... ....... ...... ...... ..... ..... ..... ..... ... .......... ....... ....... ...... ...... ... 128
The XML Designer ... ......... ....... ...... ....... ... ............... ....... ....... ... 129
Summary ..... ...... ...... ..... ...... ....... ...... ....... ... ........ ....... ...... ...... ..... ..... ..... ...... ... 131
7 Building WEB applications with vb.net and ASP.net 133
Your the asp.net application ......... ...... ...... ..... ..... ..... ..... ..... ..... ..... ...... ... 134
How to asp.net works ... ..... ...... ...... ..... ...... ..... ............. ...... ....... ....... ... 137
Web Pages and Code ... ..... ......... ....... ........ ............... ....... ....... ... 138
Server Controls ... ...... ..... ..... ..... ..... ...... ..... ..... ... ........... ....... ...... ....... ...... ... 138
Validation Controls ........ ...... ...... ..... ..... ..... ... ............... ....... ....... ... 142
Data Binding ... ....... ...... ..... ...... ...... ..... ...... ... .......... ....... ....... ...... ...... ..... ... 149
Handling Re-entrant Pages ...... .......... .......... ............... ....... ....... 151
Summary ..... ...... ...... ..... ...... ....... ...... ....... ... ........ ....... ...... ...... ..... ..... ..... ...... ... 152
8 Building WEB SERVICES with vb.net 153
Creating Your the Web Service ................ ... ............... ........ 154
Testing the Web Service ..... ................. ... ................ ........ ... 155
Creating a Web Service Client ... ................. ................. ........ 156
How Web Services Work ........... ............ ... .............. ....... ....... ... 162
And you thought Disco is Dead ... ...... ...... ............... ............. 163
Accessing Web Services ... ........... ............ ................ ........ ... 163
Summary ..... ...... ...... ..... ...... ....... ...... ....... ... ........ ....... ...... ...... ..... ..... ..... ...... ... 164
9 Building WINDOWS SERVICES with vb.net 165
Creating Your-----Windows Services Project ... .................. ... 166
Adding installers to Your Service ..... ........ ....... ...... ...... ....... ....... ..... ... 168
Configuring Your Service ..... .......... ......... ................. ........ 169
Understanding Windows Services ... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ...... ... 170
Service Lifetime and Events .......... ........... ............... ........ 171
Debugging Your Service ..... ......... ............ ................ ........ ... 172
Summary

Upgrading VB6 PROJECTS to vb.net 175
Upgrading Your the VB6 application ........ ...... ..... ..... ..... ..... ..... ..... ..... ..... .... ... 175
The Visual Basic Upgrade Wizard ..... ...... ...... ...... ...... ...... ....... ....... ... 176
Examining the upgraded Forms and Code ..... ..................... 178
Modifications ..... ....... ....... ....... ...... ...... ... .......... ....... ....... ...... ...... ... 179
Differences in Form Code ........... ............ ................. ........ 180
The Visual Basic compatibility Library ... ..... ..... ..... ...... ..... ..... ..... ...... ...... ... 181
The Upgrade Process ... ..... ....... ...... ...... ....... ... ............. ...... ....... ....... ... 182
Learn vb.net................................................................................182
Pick a Small Project and make sure which It works ... ............ 182
Upgrade the Project and examine the Upgrade of ........ 183
Fix any outstanding the Items in vb.net ... ..... ..... ....... ..... ..... ....... ... 183
Helping Your VB6 Applications Upgrade ..... ....... ..... ..... ..... ..... ..... ...... ... 183
Don't use Late Binding .................... ... ................ ........ ... 183
Specify Default Properties ... ........... .......... ................. ........ 184
Use Zero-bound Arrays ......... ........ ..... ..... ... ............... ....... ....... 184
Examine API Calls ... .......... ..... ..... ...... ...... ............... ....... ....... ... 184
Form and Control Changes ........... .......... ................ ........ 185
Summary ..... ...... ...... ..... ...... ....... ...... ....... ... ........ ....... ...... ...... ..... ..... ..... ...... ... 185
A the COMMON LANGUAGE specification 187
What is the Common Language specification? .................................. 187
vb.net Data Types and the CLS ... ..... ..... ....... ....... ....... ....... ....... ........ ... 188


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.