PDA

View Full Version : Visual Basic 2008 Express Edition/MapPointControl.ocx



Katarina Odemark
02-24-2012, 08:56 AM
MapPoint2010 works well in my new computer Windows 7/64 bits (x86)
BUT
I can not run my old programs which I have put on an USB
AND

I can't compile a small new program including the map in Visual Basic 2008 Express Edition.
I have read the earlier discussions so I have run then commander by right click, run as an administrator, regsvr32 MapPointControl.ocx. It was OK, fine!
But when I compile i got Class is not registred, 0x80040154.
Can anybody help me?
Regards Katarina

Mattys Consulting
02-24-2012, 10:16 AM
Hello Katarina,

I believe that the project needs to have a property set called 'COM-Visible.'
If Express is like the full version, you'll select the project in Project Explorer, right-click, select Properties.

Eric Frost
02-24-2012, 03:25 PM
Wow, Michael you are awesome.

Mattys Consulting
02-24-2012, 08:57 PM
Hi Eric, Thanks!
I get in a few licks :4m:

Katarina Odemark
02-28-2012, 10:57 AM
Wow, Michael you are awesome.
Eric, I tried MapPoint2011 - no difference.
Mattys, Visual Basic 2008 Express Edition is not the full version, I can't find a property set called 'COM-Visible'. Then I installed Microsoft Visual Studio 2005, which I used on my older PC, and there i had the opportunity to change TargetCPU to x86! And I could compile the program, thanks a lot!
Regards Katarina

Mattys Consulting
02-28-2012, 06:53 PM
Katarina, does this mean that you cannot set the Target CPU in the Express Version?
Maybe there is a config file that has those settings ...

marcick
02-29-2012, 01:40 AM
Here is what you need:


For VB Projects:
1. Right click the project in the solution explorer and open 'properties'
2. Choose the Compile tab
3. Press the Advanced Compile Options... button
4. Set the Target CPU property to 'X86'

Express Editions:
The VB and C# Express products do not expose the Target property inside the development environment. You will need to carefully modify the project file using a text or XML editor.
1. Close the project and/or solution
2. Select Open File from the File menu
3. Navigate to the project directory, and highlight the project file
4. Press the Open button, the project file should open in the XML editor
5. Locate the first <PropertyGroup> section and add the following line:
<PlatformTarget>x86</PlatformTarget>
1. Save the project file
2. Reopen the project and/or solution using Open Project/Solution from the File menu
3. Continue with development, debugging, and testing

Mattys Consulting
02-29-2012, 07:17 PM
Well done, marcick :tank:

Katarina Odemark
03-02-2012, 03:16 AM
Thanks for all advices!
Before I saw the response from Marcick, I had found this from Internet and it also worked!Question: I read somewhere that you can decide to compile to x86 instead of "any" but I cant find where
I saw images with these options , but my Applications Properties, Compile, Advanced Options just look different
Answer: Press options on the Tools menu . Navigate to the Projects and Solutions dropdown .
In the General section check the checkbox that says Show advanced build configurations . Click the OK button .
On the main menu dropdown the build menu and you should now have a configuration Manager menu item .
Click the configuration Manager . Change the platform to x86.

Now, I have another problem.
I have a new computer (Windows 7 / MapPoint 2011 / Visual Studio 2005 or Visual Basic 2008 Express)

I have now a lot of warnings which I did not have before. Why?

Example 1
For kLocal = 1 To Map.DataSets.Count
kLocal is declared as Short and Map.DataSets.Count is Integer, easy just declare kLocal As Integer

but Example2 (and other similar problems)
objloc is declared as MapPoint.Location
objFind is declared as MapPoint.FindResults
objFind = Map.FindPlaceResults("Sweden")
objloc = objFind.Item(1)
Here I got a warning: Implicit conversion from 'Object' to 'MapPoint.Location'

Can anybody help me?

Regards Katarina

Eric Frost
03-02-2012, 08:01 AM
Can you just ignore the warnings?

e.g. so what that objFind.Item(1) returns an object and you are assigning it to a Location object, it doesn't matter.

I suppose to prevent the warning from popping up, you could declare objLoc as an Object, but then you would lose the context-sensitive drop-downs in VS, or you would have to explicitly cast objLoc back to a Location object. In the first case you lose VS functionality, in the second you have unnecessarily made your code more complicated. Easiest just to ignore the warning ??

Eric

Katarina Odemark
03-03-2012, 02:59 PM
I ignore the warnings, thats a good advice.
Thanks Eric and others, everything is now all right.
Goodbye
Katarina