59
Best Practices for Best Practices for Upgrading Visual Upgrading Visual Basic 6.0 Projects to Basic 6.0 Projects to Visual Basic.NET Visual Basic.NET Microsoft Microsoft Corporation Corporation

Best practices for upgrading vb 6.0 projects to vb.net

Embed Size (px)

DESCRIPTION

Best Practices for Upgrading VB 6.0 Projects to VB.NET

Citation preview

Page 1: Best practices for upgrading vb 6.0 projects to vb.net

Best Practices for Best Practices for Upgrading Visual Basic Upgrading Visual Basic 6.0 Projects to 6.0 Projects to Visual Basic.NETVisual Basic.NET

Microsoft CorporationMicrosoft Corporation

Page 2: Best practices for upgrading vb 6.0 projects to vb.net

What We Will CoverWhat We Will Cover

Understanding the upgrading roadmap: Understanding the upgrading roadmap: selecting projects, preparing them for selecting projects, preparing them for the upgrade, what to leave alonethe upgrade, what to leave alone

How to interoperate between MicrosoftHow to interoperate between Microsoft®® Visual BasicVisual Basic®® 6.0 and Microsoft 6.0 and Microsoft®® Visual Visual BasicBasic®® .NET .NET

Understanding new Visual Basic.NET Understanding new Visual Basic.NET featuresfeatures

Page 3: Best practices for upgrading vb 6.0 projects to vb.net

Session PrerequisitesSession Prerequisites

Level 200Level 200

Visual Basic 6.0 programming Visual Basic 6.0 programming Component-based or object-oriented Component-based or object-oriented

developmentdevelopment MicrosoftMicrosoft®® Windows Windows®® development development Introductory or basic knowledge of Visual Introductory or basic knowledge of Visual

Basic.NET or MicrosoftBasic.NET or Microsoft®® .NET .NET

Page 4: Best practices for upgrading vb 6.0 projects to vb.net

So Why This Presentation?So Why This Presentation?

To give Visual Basic 6.0 developers To give Visual Basic 6.0 developers knowledge of how to upgrade their knowledge of how to upgrade their existing Visual Basic 6.0 applications to existing Visual Basic 6.0 applications to Visual Basic.NETVisual Basic.NET

To explain the new features of Visual To explain the new features of Visual Basic.NET and how they relate to Visual Basic.NET and how they relate to Visual Basic 6.0Basic 6.0

Page 5: Best practices for upgrading vb 6.0 projects to vb.net

DemonstrationsDemonstrations

Using the Upgrade WizardUsing the Upgrade Wizard Upgrading Visual Basic 6.0 Forms to Upgrading Visual Basic 6.0 Forms to

Windows Forms and COM interopWindows Forms and COM interop Drag and dropDrag and drop Upgrading Win32Upgrading Win32®® API calls API calls Printing in Visual Basic.NETPrinting in Visual Basic.NET

Page 6: Best practices for upgrading vb 6.0 projects to vb.net

AgendaAgenda

Introduction to Visual Basic.NETIntroduction to Visual Basic.NET Upgrading to Visual Basic.NETUpgrading to Visual Basic.NET Upgrade and COM InteropUpgrade and COM Interop Drag and drop in Visual Basic 6 and Drag and drop in Visual Basic 6 and

Visual Basic.NETVisual Basic.NET Upgrading Win32 API callsUpgrading Win32 API calls Printing in Visual Basic.NETPrinting in Visual Basic.NET

Page 7: Best practices for upgrading vb 6.0 projects to vb.net

Intro to Visual Basic.NETIntro to Visual Basic.NETWhat is Visual Basic.NET?What is Visual Basic.NET?

Next generation of Visual BasicNext generation of Visual Basic Two new forms packagesTwo new forms packages Removed legacy keywordsRemoved legacy keywords Improved type safetyImproved type safety Exposed low-level constructs for Exposed low-level constructs for

advanced developersadvanced developers Fully integrated with other MicrosoftFully integrated with other Microsoft®®

Visual StudioVisual Studio®® .NET Languages .NET Languages

Page 8: Best practices for upgrading vb 6.0 projects to vb.net

Intro to Visual Basic.NETIntro to Visual Basic.NETDesign Goals of Visual Basic.NETDesign Goals of Visual Basic.NET

Rapid .NET application creationRapid .NET application creation Deliver the features you requestedDeliver the features you requested ModernizeModernize SimplifySimplify Reduce programming errorsReduce programming errors Solve the deployment problemSolve the deployment problem Provide full access to the .NET Provide full access to the .NET

FrameworkFramework

Page 9: Best practices for upgrading vb 6.0 projects to vb.net

Intro to Visual Basic.NETIntro to Visual Basic.NETWhy is Visual Basic.NET not 100% Why is Visual Basic.NET not 100% compatible?compatible? Two design issuesTwo design issues

Retrofit existing codeRetrofit existing code Build new code from ground upBuild new code from ground up

InteroperabilityInteroperability A major goal to ensure Visual Basic code A major goal to ensure Visual Basic code

could fully interoperate with C# or C++ could fully interoperate with C# or C++ Visual Basic.NET is a true object-Visual Basic.NET is a true object-

oriented languageoriented language Removed unintuitive and inconsistent Removed unintuitive and inconsistent

featuresfeatures

Page 10: Best practices for upgrading vb 6.0 projects to vb.net

Intro to Visual Basic.NETIntro to Visual Basic.NETUpgrade RoadmapUpgrade Roadmap

Upgrading is not a requirementUpgrading is not a requirement Leave existing code in Visual Basic 6.0Leave existing code in Visual Basic 6.0

Continue developing in Visual Basic 6.0Continue developing in Visual Basic 6.0 Or interoperate between Visual Basic 6.0 and Or interoperate between Visual Basic 6.0 and

Visual Basic.NETVisual Basic.NET

Upgrade to Visual Basic.NETUpgrade to Visual Basic.NET

ConsiderationsConsiderations Application architecture and technologiesApplication architecture and technologies Maintenance or new developmentMaintenance or new development

Page 11: Best practices for upgrading vb 6.0 projects to vb.net

Intro to Visual Basic.NETIntro to Visual Basic.NETReasons To UpgradeReasons To Upgrade

Maximized productivityMaximized productivity Task List, Class ViewTask List, Class View New project typesNew project types

NT ServiceNT Service Console ApplicationConsole Application

Targets new platformsTargets new platforms Microsoft Mobile Internet ToolkitMicrosoft Mobile Internet Toolkit .NET Compact Framework.NET Compact Framework

First class object-oriented constructsFirst class object-oriented constructs InheritanceInheritance Structure exception handlingStructure exception handling Parameterized constructorsParameterized constructors

Page 12: Best practices for upgrading vb 6.0 projects to vb.net

Intro to Visual Basic.NETIntro to Visual Basic.NETReasons to UpgradeReasons to Upgrade

Instance size much smallerInstance size much smaller Visual Basic 6 – 100 bytes (apx)Visual Basic 6 – 100 bytes (apx) Visual Basic.NET – 8 bytesVisual Basic.NET – 8 bytes

Faster object manipulationFaster object manipulation Faster creationFaster creation Faster assignmentFaster assignment Supports direct data member accessSupports direct data member access

Page 13: Best practices for upgrading vb 6.0 projects to vb.net

Intro to Visual Basic.NETIntro to Visual Basic.NETReasons To UpgradeReasons To Upgrade

Windows FormsWindows Forms Visual inheritanceVisual inheritance Control anchoring, in-place menu editorControl anchoring, in-place menu editor Connected and disconnected databindingConnected and disconnected databinding

Web and server featuresWeb and server features Web formsWeb forms Web servicesWeb services RAD for the serverRAD for the server

Better deploymentBetter deployment No DLL hellNo DLL hell Builds Builds .msi.msi and and .cab.cab setup programs setup programs

Page 14: Best practices for upgrading vb 6.0 projects to vb.net

Intro to Visual Basic.NETIntro to Visual Basic.NETReasons To UpgradeReasons To Upgrade

Power featuresPower features Multi-threadingMulti-threading Debugging across all languagesDebugging across all languages

Built from the ground up on .NET Built from the ground up on .NET FrameworkFramework Direct access to .NET classesDirect access to .NET classes Code access securityCode access security ADO.NET and XMLADO.NET and XML

Page 15: Best practices for upgrading vb 6.0 projects to vb.net

Intro to Visual Basic.NETIntro to Visual Basic.NETDeploymentDeployment

No More “DLL Hell”No More “DLL Hell” Enabled by the .NET FrameworkEnabled by the .NET Framework Side-by-side, XCOPY, no restarting IIS, Side-by-side, XCOPY, no restarting IIS,

versioningversioning Windows Installer technologyWindows Installer technology

Self-repairing installations, advertising, Self-repairing installations, advertising, rollback, digital signingrollback, digital signing

Transacted, custom action authoringTransacted, custom action authoring Remote install of Web applications, Remote install of Web applications,

services, server resourcesservices, server resources

Page 16: Best practices for upgrading vb 6.0 projects to vb.net

AgendaAgenda

Introduction to Visual Basic.NETIntroduction to Visual Basic.NET Upgrading to Visual Basic.NETUpgrading to Visual Basic.NET Upgrading Windows Forms and COM Upgrading Windows Forms and COM

interopinterop Drag and drop Drag and drop Upgrading Win32 API CallsUpgrading Win32 API Calls Printing in Visual Basic.NETPrinting in Visual Basic.NET

Page 17: Best practices for upgrading vb 6.0 projects to vb.net

Upgrading to VB.NETUpgrading to VB.NETUsing the Upgrade WizardUsing the Upgrade Wizard

Included with Visual Basic.NETIncluded with Visual Basic.NET Upgrades Visual Basic 6.0 projects opened in Upgrades Visual Basic 6.0 projects opened in

Visual Basic.NETVisual Basic.NET Creates new Visual Basic.NET projectCreates new Visual Basic.NET project Existing Visual Basic 6.0 project left unchangedExisting Visual Basic 6.0 project left unchanged

Upgrade tool focusUpgrade tool focus Language syntax changesLanguage syntax changes Data type changesData type changes Visual Basic 6.0 forms and controlsVisual Basic 6.0 forms and controls Middle-tier componentsMiddle-tier components

Page 18: Best practices for upgrading vb 6.0 projects to vb.net

Upgrading to VB.NET Upgrading to VB.NET Manual UpgradeManual Upgrade

ActiveXActiveX®® documents documents DHTML ActiveX DesignerDHTML ActiveX Designer DAO and RDO data bindingDAO and RDO data binding OLE, Shape ControlOLE, Shape Control

Non-horizontal, vertical linesNon-horizontal, vertical lines Property pages Property pages Add-in extensibilityAdd-in extensibility User controlsUser controls Language featuresLanguage features

LSet, ObjPtr, VarPtr, StrPtrLSet, ObjPtr, VarPtr, StrPtr GoSub & Return, Computed GotoGoSub & Return, Computed Goto

Page 19: Best practices for upgrading vb 6.0 projects to vb.net

Upgrading to VB.NET Upgrading to VB.NET TODO CommentsTODO Comments

Assist developers when:Assist developers when: Items can not be automatically upgradedItems can not be automatically upgraded Behavior differences existBehavior differences exist

Summarized in upgrade report Summarized in upgrade report

'Visual Basic.NETDim o As ObjectO = Me.Text1'UPGRADE_WARNING: Couldn't resolve default property of object oo = "Hello World"

'Visual Basic 6Dim o As ObjectSet o = Me.Text1o = "Hello World"

Page 20: Best practices for upgrading vb 6.0 projects to vb.net

Demonstration 1Demonstration 1Step by Step Step by Step

Upgrade WizardUpgrade Wizard

Page 21: Best practices for upgrading vb 6.0 projects to vb.net

AgendaAgenda

Introduction to Visual Basic.NETIntroduction to Visual Basic.NET Upgrading to Visual Basic.NETUpgrading to Visual Basic.NET Upgrade and COM InteropUpgrade and COM Interop Drag and dropDrag and drop Upgrading Win32 API callsUpgrading Win32 API calls Printing in Visual Basic.NETPrinting in Visual Basic.NET

Page 22: Best practices for upgrading vb 6.0 projects to vb.net

Upgrade and COM InteropUpgrade and COM InteropWhy the need for COM Interop?Why the need for COM Interop? Upgrade Wizard upgrades Visual Basic 6 Upgrade Wizard upgrades Visual Basic 6

forms to .NET Windows Formsforms to .NET Windows Forms Properties, methods and eventsProperties, methods and events Most Visual Basic 6 controls have one-to-one Most Visual Basic 6 controls have one-to-one

mapping with .NET controlsmapping with .NET controls ActiveX controls are kept via COM interopActiveX controls are kept via COM interop Some things are too different for Upgrade Wizard Some things are too different for Upgrade Wizard

to upgradeto upgrade PrintingPrinting Drag and DropDrag and Drop GraphicsGraphics

Page 23: Best practices for upgrading vb 6.0 projects to vb.net

Upgrade and COM InteropUpgrade and COM InteropCOM Interoperability ServicesCOM Interoperability Services

C++C++

MSVCRTMSVCRT

MFC/ATLMFC/ATL

Type SystemType SystemStandardStandard

BinaryBinaryStandardStandard

C#C# Visual BasicVisual Basic

Runtime Execution SysRuntime Execution Sys

Runtime Type System

COM Binary Std

Page 24: Best practices for upgrading vb 6.0 projects to vb.net

Leveraging Existing CodeLeveraging Existing CodeWhy Interop?Why Interop?

Preserve and utilize your investmentPreserve and utilize your investment No need to start overNo need to start over Continue to use existing codeContinue to use existing code

Incremental migration pathIncremental migration path Migrate your application step-by-stepMigrate your application step-by-step

Reality – some things never changeReality – some things never change Need to interop with code that Need to interop with code that

can’t changecan’t change

Page 25: Best practices for upgrading vb 6.0 projects to vb.net

Leveraging Existing CodeLeveraging Existing CodeInterop ServicesInterop Services

COM interopCOM interop Use COM components from the runtimeUse COM components from the runtime Use .NET Framework components Use .NET Framework components

from COMfrom COM

Platform invokePlatform invoke Call static entry points in Call static entry points in

unmanaged DLLsunmanaged DLLs Pass function pointers to Pass function pointers to

unmanaged code for callbackunmanaged code for callback

Page 26: Best practices for upgrading vb 6.0 projects to vb.net

Leveraging Existing CodeLeveraging Existing CodeBi-Directional COM InteropBi-Directional COM Interop .NET to COM.NET to COM

Allows .NET types to access COM typesAllows .NET types to access COM types

COM to .NETCOM to .NET Allows COM types to access .NET typesAllows COM types to access .NET types

COM .NET

COM .NET

Page 27: Best practices for upgrading vb 6.0 projects to vb.net

Demonstration 2Demonstration 2Upgrading Windows Forms Upgrading Windows Forms

and COM Interopand COM Interop

Page 28: Best practices for upgrading vb 6.0 projects to vb.net

AgendaAgenda

Introduction to Visual Basic.NETIntroduction to Visual Basic.NET Upgrading to Visual Basic.NETUpgrading to Visual Basic.NET Upgrade and COM InteropUpgrade and COM Interop Drag and dropDrag and drop Upgrading Win32 API callsUpgrading Win32 API calls Printing in Visual Basic.NETPrinting in Visual Basic.NET

Page 29: Best practices for upgrading vb 6.0 projects to vb.net

Drag and DropDrag and DropOverviewOverview

Visual Basic 6 had two types of drag and dropVisual Basic 6 had two types of drag and drop Standard – designed for dragging and dropping Standard – designed for dragging and dropping

controls within a formcontrols within a form OLE – designed for drag and drop between multiple OLE – designed for drag and drop between multiple

applications, supports multiple data formatsapplications, supports multiple data formats Visual Basic.NET has one type of drag and dropVisual Basic.NET has one type of drag and drop

Somewhat similar to Visual Basic 6’s OLE drag and Somewhat similar to Visual Basic 6’s OLE drag and dropdrop

Supports drag and drop on single form and between Supports drag and drop on single form and between multiple applicationsmultiple applications

Supports multiple data formatsSupports multiple data formats Upgrade Wizard does not upgrade drag and drop Upgrade Wizard does not upgrade drag and drop

codecode

Page 30: Best practices for upgrading vb 6.0 projects to vb.net

Drag and DropDrag and DropDrag and Drop OperationsDrag and Drop Operations

Source ControlSource Control ControlName.DoDragDrop(Data, AllowedEffects)ControlName.DoDragDrop(Data, AllowedEffects) Data is the data being draggedData is the data being dragged AllowedEffects determines the type of AllowedEffects determines the type of

operation(s) allowedoperation(s) allowed CopyCopy LinkLink MoveMove ScrollScroll AllAll NoneNone

Page 31: Best practices for upgrading vb 6.0 projects to vb.net

Drag and DropDrag and DropDrag and Drop OperationsDrag and Drop Operations

TargetControl.DragEnter EventTargetControl.DragEnter Event AllowedEffectAllowedEffect

Gets the allowed effects set by the source Gets the allowed effects set by the source controlcontrol

EffectEffect Sets the effects allowed by the target controlSets the effects allowed by the target control

TargetControl.DragOver EventTargetControl.DragOver Event Similar to DragEnter event but occurs Similar to DragEnter event but occurs

repeatedlyrepeatedly

Page 32: Best practices for upgrading vb 6.0 projects to vb.net

Drag and DropDrag and DropDrag and Drop OperationsDrag and Drop Operations

Target.DragLeave EventTarget.DragLeave Event Ends drag and drop operation for target Ends drag and drop operation for target

controlcontrol

Target.DragDrop EventTarget.DragDrop Event Completes drag-and-drop operationCompletes drag-and-drop operation Data property contains the data that was Data property contains the data that was

droppeddropped Use Data.GetData to get dropped dataUse Data.GetData to get dropped data

Page 33: Best practices for upgrading vb 6.0 projects to vb.net

Demonstration 3Demonstration 3Drag and DropDrag and Drop

Page 34: Best practices for upgrading vb 6.0 projects to vb.net

AgendaAgenda

Introduction to Visual Basic.NETIntroduction to Visual Basic.NET Upgrading to Visual Basic.NETUpgrading to Visual Basic.NET Upgrade and COM InteropUpgrade and COM Interop Drag and dropDrag and drop Upgrading Win32 API callsUpgrading Win32 API calls Printing in Visual Basic.NETPrinting in Visual Basic.NET

Page 35: Best practices for upgrading vb 6.0 projects to vb.net

Upgrading Win32 API Calls Upgrading Win32 API Calls OverviewOverview Data type changesData type changes

Visual Basic 6 Integer = Visual Basic.NET ShortVisual Basic 6 Integer = Visual Basic.NET Short Visual Basic 6 Long = Visual Basic.NET IntegerVisual Basic 6 Long = Visual Basic.NET Integer Visual Basic.NET Long is 64-bitVisual Basic.NET Long is 64-bit Upgrade Wizard handles this automaticallyUpgrade Wizard handles this automatically

As Any no longer supportedAs Any no longer supported Visual Basic.NET is type safeVisual Basic.NET is type safe Must be specific about data typeMust be specific about data type Use overloading if neededUse overloading if needed

Page 36: Best practices for upgrading vb 6.0 projects to vb.net

Upgrading Win32 API Calls Upgrading Win32 API Calls Overloading ExampleOverloading Example Declare Function SendMessage Lib “user32” Declare Function SendMessage Lib “user32”

(ByVal hwnd As Integer, ByVal wMsg As (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal Integer, ByVal wParam As Integer, ByVal lParam lParam As StringAs String) As Integer) As Integer

Declare Function SendMessage Lib “user32” Declare Function SendMessage Lib “user32” (ByVal hwnd As Integer, ByVal wMsg As (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal Integer, ByVal wParam As Integer, ByVal lParam lParam As IntegerAs Integer) As Integer) As Integer

Page 37: Best practices for upgrading vb 6.0 projects to vb.net

Upgrading Win32 API CallsUpgrading Win32 API Calls Passing a Structure to an APIPassing a Structure to an API Visual Basic 6 structures (user-defined types) Visual Basic 6 structures (user-defined types)

Members were always in order declaredMembers were always in order declared Visual Basic.NET structuresVisual Basic.NET structures

Runtime may arrange structures for efficiencyRuntime may arrange structures for efficiency Marshalling attributesMarshalling attributes

System.Runtime.InteropServicesSystem.Runtime.InteropServices StructLayoutStructLayout

AutomaticAutomatic SequentialSequential ExplicitExplicit

Page 38: Best practices for upgrading vb 6.0 projects to vb.net

Upgrading Win32 API CallsUpgrading Win32 API Calls Do I still need the Win32 API?Do I still need the Win32 API? .NET Framework contains extensive .NET Framework contains extensive

class libraryclass library Many of the Win32 APIs required by Many of the Win32 APIs required by

Visual Basic 6 may no longer be neededVisual Basic 6 may no longer be needed

Page 39: Best practices for upgrading vb 6.0 projects to vb.net

Upgrading Win32 API CallsUpgrading Win32 API Calls Setting the max length on a combo boxSetting the max length on a combo box In Visual Basic 6, you would use the In Visual Basic 6, you would use the

SendMessage API, the ComboBox’s SendMessage API, the ComboBox’s handle and the CB_LIMITTEXT constanthandle and the CB_LIMITTEXT constant

In Visual Basic.NET, all ComboBoxes In Visual Basic.NET, all ComboBoxes have a MaxLength propertyhave a MaxLength property

ComboBox1.MaxLength = 20ComboBox1.MaxLength = 20

Page 40: Best practices for upgrading vb 6.0 projects to vb.net

Upgrading Win32 API Calls Upgrading Win32 API Calls Getting the Create Date of a FileGetting the Create Date of a File In Visual Basic 6, this took 5 API callsIn Visual Basic 6, this took 5 API calls

FindFirstFileFindFirstFile FindCloseFindClose FileTimeToSystemTimeFileTimeToSystemTime GetTimeZoneInformationGetTimeZoneInformation SystemTimeToTzSpecificLocalTimeSystemTimeToTzSpecificLocalTime Plus 4 structures with 27 members including two Plus 4 structures with 27 members including two

integer arraysinteger arrays In Visual Basic.NET, this is one line of codeIn Visual Basic.NET, this is one line of code

System.IO.File.GetCreationTime(“C:\Boot.ini”)System.IO.File.GetCreationTime(“C:\Boot.ini”)

Page 41: Best practices for upgrading vb 6.0 projects to vb.net

Upgrading Win32 API Calls Upgrading Win32 API Calls Min and Max Sizes of a FormMin and Max Sizes of a Form In Visual Basic.NET, these are properties of In Visual Basic.NET, these are properties of

the formthe form

In Visual Basic 6, this In Visual Basic 6, this took 5 API callstook 5 API calls GetClientRectGetClientRect DrawEdge DrawEdge SetWindowLongSetWindowLong CallWindowProc CallWindowProc CopyMemory CopyMemory Plus 2 structuresPlus 2 structures

POINTAPIPOINTAPI MINMAXINFOMINMAXINFO

Page 42: Best practices for upgrading vb 6.0 projects to vb.net

Demonstration 4Demonstration 4Upgrading Win32 API CallsUpgrading Win32 API Calls

Page 43: Best practices for upgrading vb 6.0 projects to vb.net

AgendaAgenda

Introduction to Visual Basic.NETIntroduction to Visual Basic.NET Upgrading to Visual Basic.NETUpgrading to Visual Basic.NET Upgrade and COM InteropUpgrade and COM Interop Drag and dropDrag and drop Upgrading Win32 API callsUpgrading Win32 API calls Printing in Visual Basic.NETPrinting in Visual Basic.NET

Page 44: Best practices for upgrading vb 6.0 projects to vb.net

Printing in Visual Basic.NET Printing in Visual Basic.NET Printing in VB 6Printing in VB 6

Printer objectPrinter object Copies, Orientation, ColorMode, etc.Copies, Orientation, ColorMode, etc. Print methodPrint method

Printer.Print “Hello world”Printer.Print “Hello world” PaintPicture methodPaintPicture method

Printer.PaintPicture Picture, x, y, Width, HeightPrinter.PaintPicture Picture, x, y, Width, Height Printers collectionPrinters collection

List of all available printersList of all available printers CommonDialog controlCommonDialog control

ShowPrinter methodShowPrinter method

Page 45: Best practices for upgrading vb 6.0 projects to vb.net

Printing in Visual Basic.NET Printing in Visual Basic.NET Printing the .NET WayPrinting the .NET Way PrintDocument objectPrintDocument object

Print methodPrint method Starts printing processStarts printing process

PrintPage eventPrintPage event Use Graphics object to printUse Graphics object to print

Graphics.DrawString methodGraphics.DrawString method Use instead of Printer.PrintUse instead of Printer.Print

Graphics.DrawImage methodGraphics.DrawImage method Use instead of Printer.PaintPictureUse instead of Printer.PaintPicture

Page 46: Best practices for upgrading vb 6.0 projects to vb.net

Printing in Visual Basic.NETPrinting in Visual Basic.NETSetting Page PropertiesSetting Page Properties PageSettings objectPageSettings object

LandscapeLandscape MarginsMargins PrinterResolutionPrinterResolution

Pass the PageSettings object to Pass the PageSettings object to PrintDocumentPrintDocument PrintDoc1.DefaultPageSettings = PrintDoc1.DefaultPageSettings =

CustomPageSettingsCustomPageSettings

Page 47: Best practices for upgrading vb 6.0 projects to vb.net

Printing in Visual Basic.NET Printing in Visual Basic.NET Design Time Support for PrintingDesign Time Support for Printing Five new controlsFive new controls

PrintDocumentPrintDocument PrintDialogPrintDialog PageSetupDialogPageSetupDialog PrintPreviewDialogPrintPreviewDialog PrintPreviewControlPrintPreviewControl

Page 48: Best practices for upgrading vb 6.0 projects to vb.net

Demonstration 5Demonstration 5Printing in Printing in

Visual Basic.NETVisual Basic.NET

Page 49: Best practices for upgrading vb 6.0 projects to vb.net

Session SummarySession Summary

Visual Basic.NET offers new featuresVisual Basic.NET offers new features A true object-oriented programming A true object-oriented programming

languagelanguage Closely integrated with the .NET Closely integrated with the .NET

FrameworkFramework Upgrade Wizard does most of the job, Upgrade Wizard does most of the job,

but some things are still manualbut some things are still manual Interoperable with existing Visual Basic Interoperable with existing Visual Basic

6.0 projects6.0 projects

Page 50: Best practices for upgrading vb 6.0 projects to vb.net

For More Information…For More Information… MSDN Web site at MSDN Web site at

msdn.microsoft.commsdn.microsoft.com Top 10 Reasons to Upgrade to Visual Basic.NETTop 10 Reasons to Upgrade to Visual Basic.NET

msdn.microsoft.com/vbasic/productinfo/topten/upgrade.aspmsdn.microsoft.com/vbasic/productinfo/topten/upgrade.asp Visual Basic.NET Upgrade GuideVisual Basic.NET Upgrade Guide

msdn.microsoft.com/vbasic/techinfo/articles/upgrade/guide.aspmsdn.microsoft.com/vbasic/techinfo/articles/upgrade/guide.asp .NET Show: Visual Basic.NET .NET Show: Visual Basic.NET

msdn.microsoft.com/theshow/Episode016/default.aspmsdn.microsoft.com/theshow/Episode016/default.asp Visual Basic.NET Upgrade Road MapVisual Basic.NET Upgrade Road Map

msdn.microsoft.com/vbasic/techinfo/articles/upgrade/roadmap.aspmsdn.microsoft.com/vbasic/techinfo/articles/upgrade/roadmap.asp Preparing Your Visual Basic 6.0 Applications for the Upgrade to Preparing Your Visual Basic 6.0 Applications for the Upgrade to

Visual Basic.NETVisual Basic.NET msdn.microsoft.com/library/default.asp?url=/library/en-us/msdn.microsoft.com/library/default.asp?url=/library/en-us/

dnvb600/html/vb6tovbdotnet.aspdnvb600/html/vb6tovbdotnet.asp

Page 51: Best practices for upgrading vb 6.0 projects to vb.net

Training & Training & EventsEvents

MSDN Webcasts, MSDN Online MSDN Webcasts, MSDN Online Seminars, Tech-Ed, PDC, Developer DaysSeminars, Tech-Ed, PDC, Developer Days

MSDNMSDNEssential Resources for DevelopersEssential Resources for Developers

Subscription Subscription ServicesServices

OnlineOnlineInformationInformation

MembershipMembershipProgramsPrograms

Print Print PublicationsPublications

Library, OS, Professional, Enterprise, Library, OS, Professional, Enterprise, Universal Delivered via CD-ROM, DVD, WebUniversal Delivered via CD-ROM, DVD, Web

MSDN Online, MSDN Flash, How-To MSDN Online, MSDN Flash, How-To Resources, Download CenterResources, Download Center

MSDN User GroupsMSDN User Groups

MSDN MagazineMSDN MagazineMSDN NewsMSDN News

Page 52: Best practices for upgrading vb 6.0 projects to vb.net

How-To ResourcesHow-To ResourcesSimple, Step-By-Step ProceduresSimple, Step-By-Step Procedures Embedded Development How-To ResourcesEmbedded Development How-To Resources General How-To Resources General How-To Resources Integration How-To Resources Integration How-To Resources JScript .NET How-To Resources JScript .NET How-To Resources .NET Development How-To Resources .NET Development How-To Resources Office Development Resources Office Development Resources Security How-To Resources Security How-To Resources Visual BasicVisual Basic®® .NET How-To Resources .NET How-To Resources Visual C#Visual C#™™ .NET How-To Resources .NET How-To Resources Visual StudioVisual Studio®® .NET How-To Resources .NET How-To Resources Web Development How-To Resources (ASP, IIS, XML) Web Development How-To Resources (ASP, IIS, XML) Web Services How-To Resources Web Services How-To Resources Windows Development How-To Resources Windows Development How-To Resources

http://msdn.microsoft.com/howtohttp://msdn.microsoft.com/howto

Page 53: Best practices for upgrading vb 6.0 projects to vb.net

MSDN WebcastsMSDN WebcastsInteractive, Live Online EventInteractive, Live Online Event

Interactive, Synchronous, Live Online Interactive, Synchronous, Live Online EventEvent

Discuss the Hottest Topics from Discuss the Hottest Topics from MicrosoftMicrosoft

Open and Free For The General PublicOpen and Free For The General Public Takes Place Every TuesdaysTakes Place Every Tuesdays

http://www.microsoft.com/usa/webcastshttp://www.microsoft.com/usa/webcasts

Page 54: Best practices for upgrading vb 6.0 projects to vb.net

MSDN Subscriptions MSDN Subscriptions THE way to get Visual Studio .NETTHE way to get Visual Studio .NETVisual Studio .NETVisual Studio .NET MSDN SubscriptionsMSDN Subscriptions

NE

W

ProfessionalProfessional• Tools to build applications Tools to build applications

and XML Web services for and XML Web services for Windows and the WebWindows and the Web

MSDN ProfessionalMSDN Professional$1199 new$1199 new

$899 renewal/upgrade$899 renewal/upgrade

MSDN EnterpriseMSDN Enterprise$2199 new$2199 new

$1599 renewal/upgrade$1599 renewal/upgrade

MSDN UniversalMSDN Universal$2799 new$2799 new

$2299 renewal/upgrade$2299 renewal/upgrade

Enterprise DeveloperEnterprise Developer• Enterprise lifecycle toolsEnterprise lifecycle tools• Team development supportTeam development support• Core .NET Enterprise Core .NET Enterprise

ServersServers

Enterprise ArchitectEnterprise Architect• Software and data modelingSoftware and data modeling• Enterprise templatesEnterprise templates• Architectural guidanceArchitectural guidance

Page 55: Best practices for upgrading vb 6.0 projects to vb.net

Where Can I Get MSDN?Where Can I Get MSDN?

Visit MSDN Online atVisit MSDN Online atmsdn.microsoft.commsdn.microsoft.com

Register for the MSDN Flash Email Register for the MSDN Flash Email Newsletter at Newsletter at

msdn.microsoft.com/flashmsdn.microsoft.com/flash Become an MSDN CD Subscriber at Become an MSDN CD Subscriber at

msdn.microsoft.com/subscriptionsmsdn.microsoft.com/subscriptions MSDN online seminarsMSDN online seminars

msdn.microsoft.com/training/seminarsmsdn.microsoft.com/training/seminars Attend More MSDN EventsAttend More MSDN Events

Page 56: Best practices for upgrading vb 6.0 projects to vb.net

MS PressMS PressEssential Resources for DevelopersEssential Resources for Developers

Microsoft® Visual Studio® .NET is here!Microsoft® Visual Studio® .NET is here!This is your chance to start building the next big This is your chance to start building the next big

thing. Develop your .NET skills, increase your thing. Develop your .NET skills, increase your productivity with .NET Books from Microsoft Press®productivity with .NET Books from Microsoft Press®

www.microsoft.com/mspresswww.microsoft.com/mspress

Page 57: Best practices for upgrading vb 6.0 projects to vb.net

Become A Microsoft Certified Become A Microsoft Certified Solution DeveloperSolution Developer

What Is MCSD?What Is MCSD? Premium certification for professionals who design Premium certification for professionals who design

and develop custom business solutionsand develop custom business solutions How Do I attain MCSD Certification?How Do I attain MCSD Certification?

It requires passing four exams to prove It requires passing four exams to prove competency with Microsoft solution architecture, competency with Microsoft solution architecture, desktop applications, distributed application desktop applications, distributed application development, and development toolsdevelopment, and development tools

Where Do I Get More Information?Where Do I Get More Information? For more information about certification For more information about certification

requirements, exams, and training options, requirements, exams, and training options, visit visit www.microsoft.com/mcpwww.microsoft.com/mcp

Page 58: Best practices for upgrading vb 6.0 projects to vb.net

TrainingTrainingTraining Resources for DevelopersTraining Resources for Developers Course Title:Course Title:

Course Number:Course Number: Availability:Availability: Detailed Syllabus: Detailed Syllabus: www.microsoft.com/traincertwww.microsoft.com/traincert

Course Title:Course Title: Course Number:Course Number: Availability:Availability: Detailed Syllabus: Detailed Syllabus: www.microsoft.com/traincertwww.microsoft.com/traincert

To locate a training provider for this course, please accessTo locate a training provider for this course, please access

www.microsoft.com/traincert Microsoft Certified Technical Education Centers Microsoft Certified Technical Education Centers

are Microsoft’s premier partners for training servicesare Microsoft’s premier partners for training services

Page 59: Best practices for upgrading vb 6.0 projects to vb.net