Community of VE/MapPoint Users and Developers
This is a discussion on Weird problem with MapPoint shapes and Combo Boxes within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Something really weird is happening when I try to add the name of a shape to a combo box using ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Weird problem with MapPoint shapes and Combo Boxes Code: Private Sub Command2_Click()
Dim oMap As MapPoint.Map
Dim oShape As MapPoint.Shape
Set oMap = g_oApp.ActiveMap
oMap.FindResults("Pacific Ocean")(1).GoTo
Dim locLA, locTokyo As MapPoint.Location
Set locLA = oMap.FindResults("Los Angeles, California")(1)
Set locTokyo = oMap.FindResults("Tokyo, Japan")(1)
' Create and name the shape
Set oShape = oMap.Shapes.AddLine(locLA, locTokyo)
oShape.Name = "Tokyo Route"
Me.cmbTest.AddItem oShape.Name
End Sub
Code: Private Sub Command2_Click()
Dim oMap As MapPoint.Map
Dim oShape As MapPoint.Shape
Dim iNameA, iNameB As String
Set oMap = g_oApp.ActiveMap
oMap.FindResults("Pacific Ocean")(1).GoTo
Dim locLA, locTokyo As MapPoint.Location
Set locLA = oMap.FindResults("Los Angeles, California")(1)
Set locTokyo = oMap.FindResults("Tokyo, Japan")(1)
' Create and name the shape
Set oShape = oMap.Shapes.AddLine(locLA, locTokyo)
oShape.Name = "Tokyo Route"
iNameA = mpShape.Name
iNameB = iNameA
Me.cmbTest.AddItem iNameB
End Sub
|
| ||||
|
I ran your code (the first sample) and I got "Tokyo Route" in the combo box. I don't know what to tell you? Sorry...
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
| ||||
|
VB 6.0
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
| |||
| Weird behavior
This may help explain some weird behavior: Dim iNameA, iNameB As String does not declare two variables of type String. Instead, iNameA has actually declared as a variant. Unlike other languages, VB 6 does not interpret a declaration like the following Dim i, j, k as Integer to be a declaration of 3 integers. Instead, "i" and "j", since they are not explicitly assigned a type, are automatically typed as variants. In effect, the code above is equivalent to Dim i Dim j Dim k as integer. You can check out what I am saying with the following code: Public Sub Test() Dim i as Variant Dim j, k as integer Debug.Print TypeName(i) Debug.Print TypeName(j) Debug.Print TypeName(k) End Sub |
| |||
| Re: Weird behavior Quote:
Code: Private Sub Command2_Click()
Dim oMap As MapPoint.Map
Dim oShape As MapPoint.Shape
Dim iNameA As Variant
Set oMap = g_oApp.ActiveMap
oMap.FindResults("Pacific Ocean")(1).GoTo
Dim locLA, locTokyo As MapPoint.Location
Set locLA = oMap.FindResults("Los Angeles, California")(1)
Set locTokyo = oMap.FindResults("Tokyo, Japan")(1)
' Create and name the shape
Set oShape = oMap.Shapes.AddLine(locLA, locTokyo)
oShape.Name = "Tokyo Route"
iNameA = oShape.Name
Me.cmbTest.AddItem iNameA
End Sub
|
| ||||
|
yes, SP5 Try using the ActiveX control and see if it makes a difference. Code: Dim oMap As MapPointctl.Map
Set oMap = MappointControl1.ActiveMap
Dim oShape As MapPointctl.Shape
oMap.FindResults("Pacific Ocean")(1).GoTo
Dim locLA, locTokyo As MapPointctl.Location
Set locLA = oMap.FindResults("Los Angeles, California")(1)
Set locTokyo = oMap.FindResults("Tokyo, Japan")(1)
' Create and name the shape
Set oShape = oMap.Shapes.AddLine(locLA, locTokyo)
oShape.Name = "Tokyo Route"
Me.cmbTest.AddItem oShape.Name
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
![]() |
| Tags |
| boxes, combo, mappoint, problem, shapes, weird |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mapping PO Boxes | MeliDe | MapPoint 2006/2009 Discussion | 1 | 10-21-2005 02:42 PM |
| Fill the shapes with colors problem | vidyakulkarni | MapPoint 2006/2009 Discussion | 4 | 09-28-2004 10:05 AM |
| Copying Worksheet with Combo Box | Anonymous | MapPoint 2006/2009 Discussion | 0 | 07-20-2004 05:13 PM |
| Hiding Boxes around Label shapes | andrem | MapPoint 2006/2009 Discussion | 3 | 09-25-2003 01:09 PM |
| Text Boxes | ClactonEssex | Wish List | 0 | 12-10-2002 08:52 AM |