Special Offers

Upgrading Microsoft® Visual Basic® 6.0 to Microsoft Visual Basic .NET
Author Ed Robinson, Michael Bond, Robert Ian Oliver
Pages 576
Disk 1 Companion CD(s)
Level All Levels
Published 12/18/2001
ISBN 9780735615878
ISBN-10 0-7356-1587-X
Price(USD) $59.99
To see this book's discounted price, select a reseller below.

More Information

About the Book
Table of Contents
Sample Chapter
Related Series
Related Books
About the Author

Support: Book & CD

Rate this book
Barnes Noble Amazon Quantum Books


Table of Contents

1  Visual Basic .NET Is More Than Visual Basic 6 + 1 3
    Why Break Compatibility? 6
        Adding New Features 6
        Fixing the Language 7
        Modernizing the Language8
    It Is Still Visual Basic 8
        Expect Subtle Differences 8
        Plan for a 95 Percent Automated Upgrade 9
    Why Should I Upgrade? 10
        New Language Features 10
        Windows Forms 14
        New Web Development Features 15
        Better Development Environment 15
        Is Visual Basic Still the Best Choice for Visual Basic Developers?16
    Conclusion 18
2  Visual Basic 6 and Visual Basic .Net: Differences19
    .NET Framework vs. ActiveX 19
        .NET Framework 21
        Memory Management 22
        Type Identity 25
        Threading Model 29
    Differences in the Development Environment 29
        Menu Editor 30
        Toolbox 31
        Property Browser 32
        Tab Layout Editor 33
    Forms Packages 34
        A Single Standard for Windows Forms 34
        Two Forms Packages for the Price of One 35
    Language Differences 35
        All Subroutine Calls Must Have Parentheses 37
        ByVal or ByRef Is Required 38
        Is That My Event? 38
        Arrays Must Have a Zero-Bound Lower Dimension 39
        Fixed-Length Strings Are Not Supported 40
        Variant Data Type Is Eliminated 40
        Visibility of Variables Declared in Nested Scopes Is Limited 41
    Changes in the Debugger 42
        No Edit and Continue 42
        Cannot Continue After an Error 42
        No Repainting in Break Mode 42
    Conclusion 43
3  Upgrading Options45
    Upgrading Is Optional 45
        Don't Upgrade 45
        Partial Upgrade 46
        Complete Upgrade 47
        Upgrade with Interoperability 47
    Role of the Upgrade Wizard 48
        The Upgrade Report 48
    Testing 49
    Upgrading from Earlier Versions of Visual Basic 49
    Selecting Projects to Upgrade 50
        Evaluating the Benefits 51
        Evaluating the Effort Required 55
    Developing the Upgrade Plan 58
    Conclusion 59
4  Preparing Your Project for the Upgrade to Visual Basic .NET61
    Why Change Anything?61
    Cleaning Up Legacy Code62
        VarPtr, DefInt, and Other No-Shows62
        DAO and RDO Data Binding63
    Good Visual Basic 6 Coding Practices64
        Variants and Variables64
        Early Binding vs. Late Binding vs. Soft Binding69
        Watch Out for Null and Empty73
        Implicit Object Instantiation74
    Conclusion 76
5  Your First Upgrade79
    Upgrade Walkthrough79
        What Just Happened?85
        Language Changes88
        Other Files in Your Project92
    Upgrading Project Groups94
    Using the VB Snippet Upgrade Add-In98
    Upgrading Using the Command Line99
6  Common Tasks in Visual Basic .NET101
    A Guide to Working in Visual Basic .NET101
        Creating a Visual Basic .NET Project 102
        Getting to Know the Visual Studio .NET IDE 104
        Running Your Project 106
        A Quick Introduction to Debugging 107
    Miscellaneous Items 108
        Handling Build Errors 108
        Using the Task List 109
        Using Breakpoints 110
        References 111
    Problem-Solving Techniques 112
        Using the System.Diagnostics Library 112
        Using CorDbg 113
        Simplifying Complex Expressions 114
    Conclusion 115
7  Upgrade Wizard Ins and Outs 117
    Upgrade Philosophy 117
        It's Your Code117
        Just Make It Work 118
    Compatibility Library 119
    Upgrade Wizard Capabilities and Limitations 119
    Wizard Methodology 119
        Project Upgrade 121
        Forms and Intrinsic Controls 128
        ActiveX Controls and ActiveX References 137
        Visual Basic Code 140
        Global Objects 145
        Class Modules and User Controls 145
        Objects for Accessing Data 146
        Designers 147
8  Errors, Warnings, and Issues149
    The Different Kinds of EWIs152
        Upgrade Issues152
        Upgrade ToDos153
        Run-Time Warnings154
        Design Issues154
        Upgrade Notes and Global Warnings155
    Understanding the Upgrade Report155
        Estimating Fix Time157
    Working with EWIs159
    The Different Upgrade EWIs160
        Upgrade Issues160
        Upgrade ToDos163
        Upgrade Warnings164
        Design Errors167
        Global Warnings169
        Upgrade Notes170
    Which Problems Are Not Detected?172
9  Using Visual Basic 6 with Visual Basic .NET: COM Interop175
    Where COM Interop Comes into Play177
        ActiveX Controls177
        Communication Between a .NET Client and a COM Server Component177
        Communication Between a COM Client and a .NET Server Component178
    Upgrading a Visual Basic 6 Client/Server Application178
        Creating a .NET Client That Talks to a COM Server180
        Debugging Between the Visual Basic .NET Client and Visual Basic 6 Server182
        Exposing a Visual Basic .NET Component to Be Called by a Visual Basic 6 Client184
        Debugging Between the Visual Basic 6 Client and .NET Server187
        Tying It All Together188
    Replacing COM with .NET: Binary Compatibility189
        Indirect Replacement Model190
        Enabling Binary Compatibility in Visual Basic .NET Classes191
10  Ten Common Upgrade Problems199
    Default Properties199
    AddItem and ToString with COM Objects201
    Deterministic Finalization and Garbage Collection203
        Bringing a Little Determinism to the Party205
    Generic Objects (Control/Form/Screen)206
    Dim.As New207
    Sub Main (or Default Form)208
    Font Disparities209
    Bad Constants212
    Drag and Drop213
        Drag and Drop in Visual Basic 6213
        Drag and Drop in Visual Basic .NET215
    Collection Classes219
11  Resolving Issues with Language223
    Language Elements 224
        #If.#End If Precompiler Statements 224
        Constants and Constant Expressions 224
        Control Flow 227
        File Functions 232
    Types and Type Operations 238
        Object Replaces Variant 238
        Arrays 242
    Making Your Code Thread-Safe 249
    Windows API 251
        Type Changes 252
        As Any No Longer Supported 253
        AddressOf Changes 254
        Passing User-Defined Types to API Functions 258
        ObjPtr and StrPtr Not Supported 261
12  Resolving Issues with Forms265
    Similarities in Form Structure 265
    General Issues 267
        Differences in Properties, Methods, and Events 267
        Technology Differences 269
    Issues Involving Forms274
        Event Firing Differences 274
        The Default Form: DefInstance 277
        Application Lifetime and Forms278
        MDI Forms 282
    Conclusion 283
13  Upgrading ActiveX Controls and Components285
    ActiveX Controls Are Still Supported—Yes! 285
        ActiveX Upgrade Strategy 286
    Limitations of ActiveX Control Hosting 286
    ActiveX .NET Controls: Best of Both Worlds289
        ActiveX Interop Ax Wrapper: The Windows Forms Wrapper 289
        Property and Parameter Type Mappings 290
    Standard Component Wrappers and ActiveX Control Subobjects 293
        Common Exceptions That Require Type Conversions 295
    Name Collisions 297
        Event Name Collisions 297
    Using ActiveX Components from .NET298
        When ByRef Bites298
        When a Collection Is Not a Collection299
        Nonzero-Bound Arrays 301
        Alias Types Are Not Supported 301
        Module Methods Are Not Supported 302
    Conclusion 303
14  Resolving Data Access Issues305
    Data Access in Visual Basic 306
        Code 306
        Data Binding 307
        ADO Data Environment 307
        Components That Don't Upgrade 308
    ADO.NET Is the Future 309
    General Issues with Data Access Code 309
        DAO and RDO Module Methods 309
        ADO Version 2.7 311
        Errors in Events 311
        RDO Connection 313
        Null, vbNullString, and vbNullChar 314
    ADO Data Environment 315
        Calling Dispose 315
        Initialize Event 316
        Cursor Location with Microsoft Access Databases 316
    ADO Data Binding 316
        Control Arrays of ADO Data Controls 318
        Setting Data Binding Properties at Run Time 318
    Conclusion 321
15  Problems That Require Redesign323
    Replacing the OLE Container Control 323
    Replacing Painting Functions 328
    Rewriting Clipboard Code 331
    Using the Controls Collection 333
    Using the Forms Collection 335
    Upgrading PrintForm Code 337
    Replacing Property Pages 340
    Eliminating ObjPtr, VarPtr, and StrPtr 343
    Conclusion 345
16  Upgrading COM+ Components 347
    COM+ Application Types 347
    Using COM+ in Visual Basic .NET 348
        COM+ Requirements in Visual Basic .NET 350
        Inheriting from the ServicedComponent Class 351
        Working with Attributes 352
        Creating a Strong Name for Your Assembly 356
        Registering COM+ Applications 358
    Upgrading COM+ Components 360
    Making .NET and COM Components Work Together 364
    Conclusion 364
17  Upgrading VB Application Wizard Projects 365
    App.Revision 367
    frmAbout Form 369
    frmLogin Form 370
    frmMain Form 370
        API Declare Statements 370
        mnuHelpAbout_Click Event Procedure 371
        App.HelpFile 371
        ActiveMdiChild in MDI Projects 372
        Forms Collection in frmMain_Closed 374
        Clipboard in MDI Projects 375
    frmSplash Form 376
    frmBrowser Form 378
    Data Forms 378
    Module1 Module 379
        LoadResStrings Method 379
18  Adding Value to Your Applications385
    Overview of the Sample Application 386
    New File Functions 387
        Reading the Contents of a Directory 387
        Finding All the Forms in a DLL 388
        Loading Forms Dynamically 389
        Reading and Writing to Files 389
        Using Dynamic Properties 390
    New Windows Capabilities 392
        Accessing the Registry 392
        Control Anchoring 394
        Graphics Features 394
        Windows XP-Style Controls 398
    XCopy Deployment 400
    Conclusion 401
19  Replacing ActiveX Controls with Windows Forms Controls 403
    Benefits of Upgrading Controls 404
        100 Percent .NET Compatibility 404
        Improved Versioning 404
        Simpler Deployment 405
    Process of Replacing Controls 405
        Manually Upgrading a Control 406
    Mappings for Visual Basic 6 ActiveX Controls 412
        ActiveX Controls vs. Windows Forms Controls 413
    Conclusion 416
20  Moving from ADO to ADO.NET417
    ADO.NET for the ADO Programmer 417
        Overview of ADO.NET 418
        DataSets 419
    Integrating Your ADO Code into a Visual Basic .NET Application 421
        Binding Your ADO Recordset to .NET Controls 422
        Using ADO with XML Web Services 423
    Mapping ADO Objects to ADO.NET 425
        Connection and Command Objects 425
        Recordsets 427
    Using DataViews 429
    Data Binding 430
        Binding to Windows Forms Controls 430
    A Note About Performance 432
    Conclusion 434
21  Upgrading Distributed Applications 435
    Important Concepts for Distributed Applications 436
        Loosely Coupled vs. Tightly Coupled Applications 436
        Overhead in Method Invocation 437
        Componentization and Logical Organization 439
    Distributed Technologies in .NET 440
    XML Web Services 440
        Creating a Simple XML Web Service 441
        Supporting Web Services in Your Existing Applications 446
    Remoting 452
        A Simple Remoting Example 453
        Architecture for Remoting 456
    Distributed COM+ Applications 461
        COM+ and Remoting 461
        Using SOAP Services 461
        COM+ Application Proxies in .NET 463
    Conclusion 464
    APPENDIX A  Object Mapping Reference467
    APPENDIX B  Function Mapping Reference515

Last Updated: November 28, 2001
Top of Page