hai i am working with vb6 with mapobjects2.4 and i wrote code for MaxFileBuffer Property and i also got the error message as ActiveX component cannot create object
th code is as like below:
Dim dc As New MapObjects2.DataConnection
Dim geo As New MapObjects2.GeoDataset
Dim layer As New MapObjects2.MapLayer

Private Sub setLabel()
If geo.AllowSharing Then
Label1.Caption = "MaxFileBuffer = " & Map1.MaxFileBuffer & " bytes"
Else
Label1.Caption = "File allows sharing"
End If
End Sub

Private Sub Form_Load()

dc.Database = "C:\Program Files\Esri\MapObjects2\Samples\Data\World"
Set geo = dc.FindGeoDataset("Country")

---> layer.GeoDataset = geo

Map1.Layers.Add layer

setLabel
End Sub

Dani AI

Generated

— the VB6 error "ActiveX component cannot create object" (run-time error 429) usually means the COM class can't be instantiated because the ActiveX/COM class isn't registered or one of its supporting DLLs is missing or damaged. (learn.microsoft.com)

's advice to register the OCX is the right first step, but it needs two common clarifications: on 64‑bit Windows the 32‑bit OCX must be registered with the 32‑bit regsvr32 (the SysWOW64 copy) and registration must be done from an elevated prompt; and simply copying an OCX can miss other runtime files that the control requires. Reinstalling the MapObjects runtime (or using the official redistributable) avoids missing dependencies. (support.microsoft.com)

At the code level MapObjects examples always connect the DataConnection before trying to get a GeoDataset — check that the connection succeeds and that FindGeoDataset actually returned an object before assigning it to a layer. If the DataConnection fails or the dataset name is wrong, the layer assignment will fail in different ways; verifying the Connect result isolates the cause quickly. Example (VB6 pattern):

' (illustrative) open the data source, confirm connection, then get dataset and add layer
Dim dc As New MapObjects2.DataConnection
dc.Database = "C:\Path\To\World"
If dc.Connect Then
  Set geo = dc.FindGeoDataset("Country")
  If Not geo Is Nothing Then
    Dim lyr As New MapObjects2.MapLayer
    Set lyr.GeoDataset = geo
    Map1.Layers.Add lyr
  End If
End If

(official samples show this Connect → FindGeoDataset pattern). (scribd.com)

Quick checklist to narrow it down:

  • Confirm MapObjects runtime is properly installed (use ESRI installer/samples). (appsforms.esri.com)
  • Register the OCX with the correct regsvr32 for the OS and run as admin. (support.microsoft.com)
  • Use a tiny test VB6 project or Immediate Window to CreateObject("MapObjects2.DataConnection") to see if instantiation succeeds. (learn.microsoft.com)
  • Verify dc.Connect returns True and that FindGeoDataset("Country") is not Nothing before assigning to the layer. (scribd.com)

If those checks pass but the error remains, the next useful diagnostics are: exact OS bitness, whether registration returns any error text, and whether any dependent DLLs fail to load (Dependency Walker can show missing dependencies).

Recommended Answers

All 2 Replies

it seems like your application is somehow missing .ocx file when you are trying to compile the application. place the .ocx file to your windows system directory. to find the system directory of your os goto start->run then type this :-
%systemroot%\ if ur using windows xp then system32 is your target else system is ur target.

after placing the ocx goto start->run again and type the following command :-
regsvr32 <your ocx file name>

now open your project and add the activex control again from the project->components dialog. place that on ur form

now compile the prg. it should not be any problem now.

try and give feedback

regards
Shouvik

I think this is a duplicate thread , and your question has already been replied in your other thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.