Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 8 of 8

SetFieldsVisibleInBalloon - how do I set up the array

This is a discussion on SetFieldsVisibleInBalloon - how do I set up the array within the MapPoint Desktop Discussion forums, part of the Map Forums category; The MS help for this includes the code: Code: Dim objDS As MapPoint.DataSet Dim strXNC As String With Me.ctrlMP.ActiveMap.DataSets strcnx ...

  1. #1
    jtowell is offline Junior Member White Belt
    Join Date
    Mar 2004
    Posts
    7

    SetFieldsVisibleInBalloon - how do I set up the array

    The MS help for this includes the code:
    Code:
     Dim objDS As MapPoint.DataSet 
        Dim strXNC As String 
        With Me.ctrlMP.ActiveMap.DataSets 
            strcnx = gBDD_LOCAL & "!" & "ReqSQL" 
            Set objDS = .LinkData(strcnx, "NUM_FDT", , geoCountryFrance, , geoImportAccessQuery) 
            objDS.Symbol = 26 
            arArray = Array(objDS.Fields(1), objDS.Fields(2), objDS.Fields(3), objDS.Fields(4)) 
            objDS.SetFieldsVisibleInBalloon arArray 
        End With
    In my situation, I don't know in advance which fields the user will want in the balloon.
    Can anyone tell me how to show fields 1, 4 & 5 one day and then fields 1,2,5,8,9 the next day?
    e.g. using values from an array

    dim lbInBalloon(1 to 20) as boolean

    It's probably a VB thing rather than a Map Point question, but since arArray isn't even declared, it makes the 'help' very difficult to follow!

    Cheers

    -James

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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

  3. #3
    TheJudge is offline Junior Member Yellow Belt
    Join Date
    Mar 2004
    Posts
    15
    hi everyone,

    I would like to do the same thing in C#.. anyone know how?!!

    thanks in advance,,

    Regards,
    Kam

  4. #4
    TheJudge is offline Junior Member Yellow Belt
    Join Date
    Mar 2004
    Posts
    15
    Could anyone just show me how to create that array in C# please??!

  5. #5
    MORGALA is offline Junior Member White Belt
    Join Date
    Apr 2005
    Posts
    2
    string gicListUDL = Application.StartupPath + @"\..\..\Resources\MapPointConnection.udl" + "!vwGICList";
    this.axMappointControl1.ActiveMap.MapStyle = MapPoint.GeoMapStyle.geoMapStyleRoadData;

    MapPoint.DataSet ds = this.axMappointControl1.ActiveMap.DataSets.ImportD ata(gicListUDL, null, MapPoint.GeoCountry.geoCountryMultiCountry, MapPoint.GeoDelimiter.geoDelimiterDefault, MapPoint.GeoImportFlags.geoImportAccessTable);

    object o1 = 1, o2 = 2, o3 = 3, o4 = 4, o5 = 5, o6 = 6, o7 = 7, o8 = 8;
    object[] fields = new object[8]{ds.Fields.get_Item(ref o1), ds.Fields.get_Item(ref o2), ds.Fields.get_Item(ref o3), ds.Fields.get_Item(ref o4), ds.Fields.get_Item(ref o5), ds.Fields.get_Item(ref o6), ds.Fields.get_Item(ref o7), ds.Fields.get_Item(ref o8)};

    ds.SetFieldsVisibleInBalloon(fields);

  6. #6
    ChrisSproston is offline Junior Member White Belt
    Join Date
    May 2005
    Posts
    2

    VB.NET???

    Hi All

    I'd like a VB.NET Version if anyone could knock one together please?! I've been trying for ages to get the Array working in .NET but to no avail?!!

    Can somone please help!!!

  7. #7
    ChrisSproston is offline Junior Member White Belt
    Join Date
    May 2005
    Posts
    2

    VB.NET???

    Hi All

    I'd like a VB.NET Version if anyone could knock one together please?! I've been trying for ages to get the Array working in .NET but to no avail?!!

    Can somone please help!!!

  8. #8
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: VB.NET???

    Hi,

    Quote Originally Posted by ChrisSproston
    I've been trying for ages
    You must be very old by now

    to get the Array working in .NET but to no avail?!!
    Euh what exacly do you wants to know ?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help! Import Custom Symbol Array
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 03-24-2011, 10:45 AM
  2. How to access to an array of pushpins that were added ?
    By Jaba in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 01-13-2005, 07:20 AM
  3. Addpolyline , Array , Visual Basic and Other languages
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 08-26-2004, 04:58 AM
  4. Importing address with an array of fields specified
    By jscott099 in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 12-30-2003, 11:10 PM
  5. array of locations
    By Bart Vervenne in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 04-14-2003, 05:03 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96