Something really weird is happening when I try to add the name of a shape to a combo box using VB 6.0. Below is an example that reproduces the error. I created a single form with one command button and one combo box (cmbTest) then attached the following code to the command button. g_oApp was previously attached to the MapPoint object.
You would think that "Tokyo Route" would appear in the combo box.. but instead I get "T". I can't figure it out. If I do a "MsgBox oShape.Name" I get the full name but the combo box only shows the first letter. I have found a work around but it is very annoying and doesn't make any sense.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
Can anyone else confirm this. Is it just my computer. I suspect there is some weird compilation error. Or am I just missing something.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