View Single Post

  #2 (permalink)  
Old 03-25-2004
Anonymous Anonymous is offline
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
I battled with this one for a long time also. The help files are pretty much worthless when trying to figure out how to set up the arrays. It took lots of trial and error, but I found a few obscure hints on google and came up with the following. It is VB6 code, adjust as needed. I was intentionally displaying all fields in the balloon except for the field defined as the "name" field, along with lat/long (my points were already geocoded)

Let me know if you have any questions or comments.

Kirk dot Dybvik
at
benfieldgroup dot com



<snip from my routine that loads dataset>
Dim vBallonFieldsArray As Variant

oDataset.FieldNamesVisibleInBalloon = True
vBallonFieldsArray = PrepBallonDisplayFields(oDataset)
oDataset.SetFieldsVisibleInBalloon vBallonFieldsArray
</snip>

'************************************************* *********
Private Function PrepBallonDisplayFields(oDataset As MapPoint.DataSet) As Variant
Dim FieldN()
Dim sFieldName As String
Dim i As Integer
Dim lBalloonFieldCount As Long
Dim oField As MapPoint.Field

lBalloonFieldCount = 0

'*** allocate "worst case" array size
ReDim FieldN(1 To oDataset.Fields.Count)

For Each oField In oDataset.Fields
sFieldName = UCase$(oField.Name)

Select Case sFieldName
Case UCase$(m_sNameField), "LATITUDE", "LONGITUDE"
'*** don't display name, lat, or long in balloon...

Case Else
'*** add to array and increment counter
lBalloonFieldCount = lBalloonFieldCount + 1

'*** IMPORTANT: need to use Set to get object reference
Set FieldN(lBalloonFieldCount) = oField

End Select

Next

'*** adjust array to desired size
ReDim Preserve FieldN(1 To lBalloonFieldCount)

'*** return the array as a variant
PrepBallonDisplayFields = FieldN

End Function
Reply With Quote