MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




vb6 to vb.net conversion woes

This is a discussion on vb6 to vb.net conversion woes within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi All In VB6 on form load of main form I have the following code mc1.OpenMap App.Path + "\MTMap.ptm" mc1.Units ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-23-2004
starbuck's Avatar
Member
Green Belt
 
Join Date: Oct 2003
Posts: 68
vb6 to vb.net conversion woes

Hi All

In VB6 on form load of main form I have the following code

mc1.OpenMap App.Path + "\MTMap.ptm"
mc1.Units = geoMiles
mc1.Visible = True
mc1.ActiveMap.DragBehavior = 2
mc1.ActiveMap.AllowEdgePan = True
mc1.ItineraryVisible = False
Map_Resize

In vb.net I have the following

mc1.OpenMap(MTDir + "\MTMap.ptm")
mc1.Units = MapPoint.GeoUnits.geoMiles
mc1.Visible = True
mc1.ActiveMap.DragBehavior = 2
mc1.ActiveMap.AllowEdgePan = True
mc1.ItineraryVisible = False
Map_Resize()

And I get the following error on the first line - Exception of type InvalidActiveXStateException was thrown.

Any thoughts folks, I am using a the ocx on the main form

Thanks in advance
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 07-23-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
I believe you have to use NewMap for a new instance of the map object:

mc1.NewMap(MTDir + "\MTMap.ptm")

Roger
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 07-23-2004
starbuck's Avatar
Member
Green Belt
 
Join Date: Oct 2003
Posts: 68
vb6 to vb.net conversion woes

Thanks, will give that a go
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 07-23-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Sorry to mislead but you can use OpenMap, the following actually works:

Public Class Form1
Inherits System.Windows.Forms.Form

Public objApp As AxMapPoint.AxMappointControl
Public objMap As MapPoint.Map

Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
objApp = AxMappointControl1
objMap = objApp.NewMap("C:\TestMap.ptm")
objMap = objApp.ActiveMap

If objMap Is Nothing Then
'handle errors
Exit Sub
End If

'Then do everything via objApp and objMap.
'Didn't need to set visible.

End Sub

I can't see the basic diference but it works if thats any help?

Roger
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 07-23-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Please ignore previous posting this is what I should have said:

Sorry to mislead but you can use OpenMap, the following actually works:

Public Class Form1
Inherits System.Windows.Forms.Form

Public objApp As AxMapPoint.AxMappointControl
Public objMap As MapPoint.Map

Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)

objApp = AxMappointControl1
objMap = objApp.OpenMap("C:\TestMap.ptm")
objMap = objApp.ActiveMap

If objMap Is Nothing Then
'handle errors
Exit Sub
End If

'Then do everything via objApp and objMap.
'Didn't need to set visible.

End Sub

End Class

I can't see the basic diference but it works if thats any help?

Roger
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 07-23-2004
starbuck's Avatar
Member
Green Belt
 
Join Date: Oct 2003
Posts: 68
re

Thanks Roger
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
conversion, vb6, vbnet, woes


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Lat/Long conversion klomp63 MapPoint 2006/2009 Discussion 1 03-14-2006 03:29 PM
OLEVariant conversion phoque MapPoint 2006/2009 Discussion 1 10-10-2005 01:44 PM
Help Re Conversion please Ticker MapPoint 2006/2009 Discussion 2 11-09-2004 11:25 AM
Coordinate conversion Matrices MapPoint 2006/2009 Discussion 3 10-03-2003 08:13 AM
ED50 to wgs84 conversion Nicou MapPoint 2006/2009 Discussion 2 04-25-2003 03:22 AM


All times are GMT -5. The time now is 04:12 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54