PDA

View Full Version : mappoint europe 2004 and visual basic 6.0



Anonymous
04-09-2004, 07:34 AM
I'm using mappoint europe 2004 and i'm trying to let it work alongside visual basic 6.0
In msdn there's this line
"Dim objApp As New MapPoint.Application"
when I want to use it vb says the following: "User-defined type not defined"
what am I doing wrong? :s

greetz

Anonymous
04-09-2004, 02:38 PM
check you references

Anonymous
04-11-2004, 03:09 AM
hmmm, thx ;)

Anonymous
04-14-2004, 06:46 AM
now, my next question is
I have al sorts of textboxes on my form, but when I type a city in one of them and then click on see map, I want a pushpin on the place of the user-given city...
can somebody help me out here?

thx already

Syd
04-14-2004, 08:25 AM
try using the findresults function on the ActiveMap. Read the documentation ( last point programming with mappoint ). If you have your references checked, press F1 to get more infos :D

Dim objApp As New MapPoint.Application
Dim objFindResults As MapPoint.FindResults

'Anwendung einrichten
objApp.Visible = True
objApp.UserControl = True

'Erstes Ergebnis der Suche ausgeben
Set objFindResults = objApp.ActiveMap.FindResults("Seattle, WA")
MsgBox "Das erste Element in der Ergebnisliste lautet: " _
+ objFindResults.Item(1).Name


Greetings,
Syd

Anonymous
04-14-2004, 08:37 AM
i'm working with msdn online help, but the finding is not easy for a man without patience ;)
thx btw Syd!

Syd
04-14-2004, 08:42 AM
Read & try & error or learning by doing :D

If you have any questions just ask.

Greetz,
Syd

Anonymous
04-14-2004, 03:01 PM
ok thx
the previous code you gave me is fine but it doesn't put any pushpin on my map? i was looking for that online but nothing could help me out of my problem.
i'm working with a map in visual basic itself and the code is only based on a map outside visual basic...

greetings from belgium ;)

Syd
04-15-2004, 08:30 AM
To add a pushpin on the map, there's a function called "AddPushpin". All you need is a location object, like the one you get from the Findresults-Collection.

The help file VB reference is very useful.

First you'll have to search for an address, then you pick one from the findresults-collection, then add the item as pushpin and then make a zoom and that's it :D Of course you can change the symbol of the pushpin and add some text to the pushpin.note and show it.

Perhaps you can make a search for mappoint.hlp -> there is also some good advice in it. I still find a lot of things I can put into my application. :D I'm looking forward to Mappoint 2005 - I hope there's a lot more cool stuff in it then :lol:

Greetings from Germany,
Syd

Syd
04-15-2004, 08:32 AM
i'm working with a map in visual basic itself and the code is only based on a map outside visual basic...



Errm - what do you mean? Two maps?

Greetz,
Syd

Anonymous
04-15-2004, 08:54 AM
what you mean is that when you click your "submit button" you go to mappoint2004 itself
I only open another form in my visual basic project where the map is

Anonymous
04-15-2004, 11:23 AM
I have my mappoint control in a usercontrol which I put in a form.

Syd
04-15-2004, 11:24 AM
I have my mappoint control in a usercontrol which I put in a form.
It is an activex server exe.

Greetings,
Syd

yvdp
04-17-2004, 07:19 AM
I do the exact same thing
i use only 1 map but it's on another form in my project

yvdp
04-19-2004, 01:04 PM
next problem ;)
runtime error 429:
ActiveX component can't create object

i'm using this code:
Dim omap As MapPoint.Map
Set omap = GetObject(, "MapPoint.Application").ActiveMap

Dim oPPSet As MapPoint.DataSet
Dim oPin As MapPoint.Pushpin
Dim oDS As MapPoint.DataSets

Set oPin = omap.AddPushpin(omap.FindResults( _
txtKaart.Text)(1))

Set oDS = omap.DataSets
Set oPPSet = omap.DataSets.AddPushpinSet("Deliveries")
oPin.MoveTo oPPSet

it higlights the "set omap..." sentence
my mappoint control is ok, what's wrong?

Anthony_Hunt
04-20-2004, 04:34 AM
On a VB form with three address entry lines "address_line1" etc., a MapPoint control named "MapPointControl1", and a button named "btnFind".


Private Sub btnFind_Click()

Dim objPin As Pushpin
Dim objLoc As Location
Dim place As String

place = Me.address_line1.Text & ", " & Me.address_line2.Text & ", " & Me.address_line3.Text

Set objLoc = Me.MappointControl1.ActiveMap.FindResults(place).I tem(1)

If objLoc Is Nothing Then
Msgbox "Nothing Found"
Exit Sub
End If

Set objPin = Me.MappointControl1.ActiveMap.AddPushpin(objLoc, Me.address_line1.Text)
objPin.Symbol = 78 '# red house
objPin.note = place
objPin.BalloonState = geoDisplayBalloon

End Sub

yvdp
04-20-2004, 08:59 AM
I get an error on this line
"Set objLoc = MappointControl1.ActiveMap.FindResults(place).Item (1)"

error: object variable or With object variable not set
runtime error "91"

thx Anthony

Anthony_Hunt
04-20-2004, 09:13 AM
Have you initialised the MapPoint ActiveX on the form in the Form_Load event?


Private Sub Form_Load()

Me.MappointControl1.newMap geoMapEurope ' geoMapNorthAmerica

End Sub

Otherwise "ActiveMap" is Nothing (hence "object not set").

Try that and let me know if you're still stuck.

yvdp
04-20-2004, 09:21 AM
thank you so very much
it works now :)

greeting from belgium!

Anonymous
05-05-2004, 10:44 PM
I get an error on this line
"Set objLoc = MappointControl1.ActiveMap.FindResults(place).Item (1)"

error: object variable or With object variable not set
runtime error "91"

thx Anthony