SlideShare une entreprise Scribd logo
1  sur  30
Migrating from VBA to .NET  Desktop Add-ins Lesley Bross Portland State Universitylbross@pdx.edu March 29, 2011
Project background CSAR engaged in a multi-year agreement with the USDA-NRCS, National Weather and Climate Council (NWCC) to develop a spatial decision support system (SDSS) The new SDSS is intended to replace the USGS GIS Weasel tool used by NWCC to improve water forecast accuracy The project was funded by USDA-NRCS National Water and Climate Center  (CESU Agreement #: 68-7482-10-514)
More background GIS Weasel’s last release was in 2003 The GIS Weasel is used to: Prepare watershed GIS layers for Areas Of Interest (AOI) Delineate Hydrological Response Units (HRU) Generate HRU physical parameters that are used in hydrological models to forecast water supply ,[object Object]
HRU Delineation phase began summer 2010,[object Object]
What about .NET add-ins ? Install as plug-in to ArcMap; No Windows installation required Single file - simple to distribute E-mail attachment Well-known folder (network location)
What about .NET add-ins ? 3)  .NET add-in Development framework  is robust and relatively easy-to-use Wizards assist with adding components No need to write COM interfaces Benefits of .NET development environment (Intellisense, debugging, unit testing) Access to entire library of VB .NET form controls (DataGridView, Tooltip, etc.)
Development environment ArcMap 10.0 desktop client Microsoft IDE (Integrated Development Environment) Visual Basic 2008 Express (free)http://www.microsoft.com/express/downloads/ Visual Studio 2010 Professional (free for 90 days with registration) ,[object Object]
ArcObjects 10 SDKAvailable on ArcMap Install CD May also want to install VBA support
IDE Express vs. Pro - ArcGIS Templates Packaging: Packaging for COM (.dll) deployment; Missing from Express but not needed for add-ins ArcGIS Snippet Finder doesn’t work as documented in Express Screenshots in documentation aren’t quite the same in Express Debugger configured manually in Express (ArcGIS templates can cover this)
C# or VB .NET ? Familiarity with Visual Basic from using VBA made VB .NET an easier transition VB .NET provided a migration path for our existing VBA scripts Industry trends towards C# - ESRI Dev Summit
Converting VBA code to use in .NET 1) Export forms and code modules from inside the VBA editor. Forms cannot be converted but their associated code can be exported.
Converting – step 2 2) Dust off an old copy of Visual Basic 6 and create a new project. Add your exported VBA files to this project. “Washing” the code through VB6 allows you to run the VB upgrade wizard.
Converting – step 3 3) Open the VB 6 project in Visual Basic 2008. The .NET version of VB will recognize the VB 6 project and volunteer to upgrade it to Visual Basic 2008.
Converting – step 4 4) Create a new Visual Basic 2008 ArcMap Add-In project per ESRI guidelines
Converting – step 5 5) Recreate the forms from the VBA project. Note: using the same field names results in less work when migrating the code. The add-in framework supports both ESRI DockableWindow and Windows Form objects for the UI.
Converting – step 6 6) Copy and paste the code from the converted project to the new project. Clean up warnings and review comments added by the conversion routine
Language differences There are lots! (see references at end) Application: Application -> My.ArcMap.Application Document: ThisDocument ->  My.ArcMap.Document Exception handling: On Error GoTo / On Error Resume Next ->Try Catch Finally and throwing exceptions
Our solution Leave BAGIS (phase 1) tools in VBA with their toolbar Develop HRU delineation tools on a separate toolbar with VB .NET Convert re-usable functions from VBA to VB .NET using aforementioned process Forms were not converted
Introducing HDGIS
Unit Testing
What is unit testing? Testing individual pieces/modules of code (functions or subs) Provide known inputs and check output for expected results; Replaces user interface NUnit: open source testing framework for .NET; Integrates with VB Express/Visual Studio. It’s free!
Using NUnit Download/install .exe from the NUnit website Create a project separate from ArcObjects project; No templates Add nunit.framework to project assemblies Set NUnit as debug application; You can step through code while running Nunit tests NUnit debug configuration will vary depending on IDE
NUnit organization Testing subs are in separate module from code they are testing Testing subs are stored in test folder Test data may also live in test project Test project separate from Add-In project Code modules are copied from test project to Add-In project when are validated No testing subs/data in Add-In project; No forms in test project
TextFixtureSetUp ,[object Object],[object Object]
TextFixtureTearDown ,[object Object],[object Object]
Failed tests
References ,[object Object]
ArcGIS Visual Studio IDE Integration Framework for extending ArcObjects: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000021w000000
GEOG 490/590: GIS Programming: http://web.pdx.edu/~jduh/courses/geog490w11/index.htm
Migrating VBA/VB6 ArcObjects Applications to .NET: http://proceedings.esri.com/library/userconf/devsummit08/papers/migrating_vba-vb6_arcobjects_applications_to_net.pdf,[object Object]

Contenu connexe

Tendances

Cloud Native Testing, 2020 Edition: A Modern Blueprint for Pre-production Tes...
Cloud Native Testing, 2020 Edition: A Modern Blueprint for Pre-production Tes...Cloud Native Testing, 2020 Edition: A Modern Blueprint for Pre-production Tes...
Cloud Native Testing, 2020 Edition: A Modern Blueprint for Pre-production Tes...OlyaSurits
 
CA Harvest "Private Solutions - State of New Hampshire
CA Harvest "Private Solutions - State of New HampshireCA Harvest "Private Solutions - State of New Hampshire
CA Harvest "Private Solutions - State of New HampshireBill Mannion (LION)
 
A PRESENTATION ON STRUTS & HIBERNATE
A PRESENTATION ON STRUTS & HIBERNATEA PRESENTATION ON STRUTS & HIBERNATE
A PRESENTATION ON STRUTS & HIBERNATETushar Choudhary
 

Tendances (6)

Spring GraphQL
Spring GraphQLSpring GraphQL
Spring GraphQL
 
desktop_resume
desktop_resumedesktop_resume
desktop_resume
 
Cloud Native Testing, 2020 Edition: A Modern Blueprint for Pre-production Tes...
Cloud Native Testing, 2020 Edition: A Modern Blueprint for Pre-production Tes...Cloud Native Testing, 2020 Edition: A Modern Blueprint for Pre-production Tes...
Cloud Native Testing, 2020 Edition: A Modern Blueprint for Pre-production Tes...
 
CA Harvest "Private Solutions - State of New Hampshire
CA Harvest "Private Solutions - State of New HampshireCA Harvest "Private Solutions - State of New Hampshire
CA Harvest "Private Solutions - State of New Hampshire
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
A PRESENTATION ON STRUTS & HIBERNATE
A PRESENTATION ON STRUTS & HIBERNATEA PRESENTATION ON STRUTS & HIBERNATE
A PRESENTATION ON STRUTS & HIBERNATE
 

Similaire à Migrating from VBA to .NET Desktop Add-Ins

Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.netJaya Kumari
 
Background Tasks with Worker Service
Background Tasks with Worker ServiceBackground Tasks with Worker Service
Background Tasks with Worker Servicessusere19c741
 
Microsoft .NET 6 -What's All About The New Update
Microsoft .NET 6 -What's All About The New UpdateMicrosoft .NET 6 -What's All About The New Update
Microsoft .NET 6 -What's All About The New UpdateAdam John
 
Martin Koons Resume 2015
Martin Koons Resume 2015Martin Koons Resume 2015
Martin Koons Resume 2015Marty Koons
 
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...Anil Sharma
 
235042632 super-shop-ee
235042632 super-shop-ee235042632 super-shop-ee
235042632 super-shop-eehomeworkping3
 
A simplest way to reconstruct .Net Framework - CRB Tech
A simplest way to reconstruct .Net Framework - CRB TechA simplest way to reconstruct .Net Framework - CRB Tech
A simplest way to reconstruct .Net Framework - CRB TechPooja Gaikwad
 
A simplest-way-to-reconstruct-.net-framework
A simplest-way-to-reconstruct-.net-frameworkA simplest-way-to-reconstruct-.net-framework
A simplest-way-to-reconstruct-.net-frameworksonia merchant
 
Azure DevOps for Developers
Azure DevOps for DevelopersAzure DevOps for Developers
Azure DevOps for DevelopersSarah Dutkiewicz
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan
 
Entity Framework Code First Migrations
Entity Framework Code First MigrationsEntity Framework Code First Migrations
Entity Framework Code First MigrationsDiluka99999
 
I T Mentors V S2008 Onramp240 V1
I T Mentors  V S2008  Onramp240 V1I T Mentors  V S2008  Onramp240 V1
I T Mentors V S2008 Onramp240 V1llangit
 
State of GeoServer - FOSS4G 2016
State of GeoServer - FOSS4G 2016State of GeoServer - FOSS4G 2016
State of GeoServer - FOSS4G 2016GeoSolutions
 

Similaire à Migrating from VBA to .NET Desktop Add-Ins (20)

Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.net
 
Background Tasks with Worker Service
Background Tasks with Worker ServiceBackground Tasks with Worker Service
Background Tasks with Worker Service
 
Working in Visual Studio.Net
Working in Visual Studio.NetWorking in Visual Studio.Net
Working in Visual Studio.Net
 
Microsoft .NET 6 -What's All About The New Update
Microsoft .NET 6 -What's All About The New UpdateMicrosoft .NET 6 -What's All About The New Update
Microsoft .NET 6 -What's All About The New Update
 
Martin Koons Resume 2015
Martin Koons Resume 2015Martin Koons Resume 2015
Martin Koons Resume 2015
 
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...
 
235042632 super-shop-ee
235042632 super-shop-ee235042632 super-shop-ee
235042632 super-shop-ee
 
A simplest way to reconstruct .Net Framework - CRB Tech
A simplest way to reconstruct .Net Framework - CRB TechA simplest way to reconstruct .Net Framework - CRB Tech
A simplest way to reconstruct .Net Framework - CRB Tech
 
A simplest-way-to-reconstruct-.net-framework
A simplest-way-to-reconstruct-.net-frameworkA simplest-way-to-reconstruct-.net-framework
A simplest-way-to-reconstruct-.net-framework
 
Azure DevOps for Developers
Azure DevOps for DevelopersAzure DevOps for Developers
Azure DevOps for Developers
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2
 
ITCV
ITCVITCV
ITCV
 
124157075 gb
124157075 gb124157075 gb
124157075 gb
 
.Net Core
.Net Core.Net Core
.Net Core
 
Entity Framework Code First Migrations
Entity Framework Code First MigrationsEntity Framework Code First Migrations
Entity Framework Code First Migrations
 
dot net
dot netdot net
dot net
 
I T Mentors V S2008 Onramp240 V1
I T Mentors  V S2008  Onramp240 V1I T Mentors  V S2008  Onramp240 V1
I T Mentors V S2008 Onramp240 V1
 
Reactjs
ReactjsReactjs
Reactjs
 
State of GeoServer - FOSS4G 2016
State of GeoServer - FOSS4G 2016State of GeoServer - FOSS4G 2016
State of GeoServer - FOSS4G 2016
 
Asp.net Vs Vue.js.pdf
Asp.net Vs Vue.js.pdfAsp.net Vs Vue.js.pdf
Asp.net Vs Vue.js.pdf
 

Dernier

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Dernier (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

Migrating from VBA to .NET Desktop Add-Ins

  • 1. Migrating from VBA to .NET Desktop Add-ins Lesley Bross Portland State Universitylbross@pdx.edu March 29, 2011
  • 2. Project background CSAR engaged in a multi-year agreement with the USDA-NRCS, National Weather and Climate Council (NWCC) to develop a spatial decision support system (SDSS) The new SDSS is intended to replace the USGS GIS Weasel tool used by NWCC to improve water forecast accuracy The project was funded by USDA-NRCS National Water and Climate Center (CESU Agreement #: 68-7482-10-514)
  • 3.
  • 4.
  • 5. What about .NET add-ins ? Install as plug-in to ArcMap; No Windows installation required Single file - simple to distribute E-mail attachment Well-known folder (network location)
  • 6. What about .NET add-ins ? 3) .NET add-in Development framework is robust and relatively easy-to-use Wizards assist with adding components No need to write COM interfaces Benefits of .NET development environment (Intellisense, debugging, unit testing) Access to entire library of VB .NET form controls (DataGridView, Tooltip, etc.)
  • 7.
  • 8. ArcObjects 10 SDKAvailable on ArcMap Install CD May also want to install VBA support
  • 9. IDE Express vs. Pro - ArcGIS Templates Packaging: Packaging for COM (.dll) deployment; Missing from Express but not needed for add-ins ArcGIS Snippet Finder doesn’t work as documented in Express Screenshots in documentation aren’t quite the same in Express Debugger configured manually in Express (ArcGIS templates can cover this)
  • 10. C# or VB .NET ? Familiarity with Visual Basic from using VBA made VB .NET an easier transition VB .NET provided a migration path for our existing VBA scripts Industry trends towards C# - ESRI Dev Summit
  • 11. Converting VBA code to use in .NET 1) Export forms and code modules from inside the VBA editor. Forms cannot be converted but their associated code can be exported.
  • 12. Converting – step 2 2) Dust off an old copy of Visual Basic 6 and create a new project. Add your exported VBA files to this project. “Washing” the code through VB6 allows you to run the VB upgrade wizard.
  • 13. Converting – step 3 3) Open the VB 6 project in Visual Basic 2008. The .NET version of VB will recognize the VB 6 project and volunteer to upgrade it to Visual Basic 2008.
  • 14. Converting – step 4 4) Create a new Visual Basic 2008 ArcMap Add-In project per ESRI guidelines
  • 15. Converting – step 5 5) Recreate the forms from the VBA project. Note: using the same field names results in less work when migrating the code. The add-in framework supports both ESRI DockableWindow and Windows Form objects for the UI.
  • 16. Converting – step 6 6) Copy and paste the code from the converted project to the new project. Clean up warnings and review comments added by the conversion routine
  • 17. Language differences There are lots! (see references at end) Application: Application -> My.ArcMap.Application Document: ThisDocument -> My.ArcMap.Document Exception handling: On Error GoTo / On Error Resume Next ->Try Catch Finally and throwing exceptions
  • 18. Our solution Leave BAGIS (phase 1) tools in VBA with their toolbar Develop HRU delineation tools on a separate toolbar with VB .NET Convert re-usable functions from VBA to VB .NET using aforementioned process Forms were not converted
  • 21. What is unit testing? Testing individual pieces/modules of code (functions or subs) Provide known inputs and check output for expected results; Replaces user interface NUnit: open source testing framework for .NET; Integrates with VB Express/Visual Studio. It’s free!
  • 22. Using NUnit Download/install .exe from the NUnit website Create a project separate from ArcObjects project; No templates Add nunit.framework to project assemblies Set NUnit as debug application; You can step through code while running Nunit tests NUnit debug configuration will vary depending on IDE
  • 23. NUnit organization Testing subs are in separate module from code they are testing Testing subs are stored in test folder Test data may also live in test project Test project separate from Add-In project Code modules are copied from test project to Add-In project when are validated No testing subs/data in Add-In project; No forms in test project
  • 24.
  • 25.
  • 27.
  • 28. ArcGIS Visual Studio IDE Integration Framework for extending ArcObjects: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000021w000000
  • 29. GEOG 490/590: GIS Programming: http://web.pdx.edu/~jduh/courses/geog490w11/index.htm
  • 30.
  • 32.