HOW TO

Dynamically add Map Control to a Visual Basic 6.0 application

Last Published: April 25, 2020

Summary

** Internal Publish Only! This article may contain information that is not intended for external circulation. **

A license key is required when you distribute a dynamically created Map Control. This article shows how to programmatically add a Map Control to Visual Basic application using a license key.

Procedure

The license key for MapObjects is "Copyright (c) 1999 ESRI, Inc.". The license key is located in MO20.lic file.
  1. Create a new Visual Basic 6.0 application.
  2. Create an object reference as VBControlExtender

    Code:
    Option Explicit

    Private mapCtl As VBControlExtender

  3. Add a Button control to the form. In the button's click event paste the following code:

    Code:
    Private Sub Command1_Click()

    'Add MapObjects license key to the control with ProgId
    Licenses.Add "MapObjects2.Map.1", "Copyright (c) 1999 ESRI, Inc."

    'Load Map control (mMap) to the form
    Set mapCtl = Form1.Controls.Add("MapObjects2.Map.1", "mMap")

    'Show Map Control
    mapCtl.Visible = True

    'Use Object keyword to access the properties and methods of Map Control
    mapCtl.object.BackColor = moRed

    End Sub

Article ID:000006278

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options