Home All Groups Group Topic Archive Search About

dynamic array question???

Author
14 Dec 2006 10:03 PM
Marc
Hi the below code works fine.

however as i wont always know that the objloc array has 4
parameters...how can i modify this code so that the array is dynamic??

Sub MapSelectedProperties()
Dim objLoc2(1 to 4) As MapPoint.Location
Dim i As Integer
i = 0
    Set Recordset = CurrentDb.OpenRecordset("SELECT * FROM
tblProperties;")
  If Recordset.RecordCount > 0 Then
          While Not Recordset.EOF
           i = i + 1
           Set objLoc2(i) =
objMap.FindAddressResults(Recordset!strStreet, Recordset!strCity,
Recordset!strState, Recordset!strPostalCode)(1)
        Set objPin = objMap.AddPushpin(objLoc2(i), Recordset!strStreet)
                        Recordset.MoveNext
  Wend
       End If
          ' objMap.Shapes.AddPolyline objLoc2

Author
14 Dec 2006 10:15 PM
tommaso.gastaldi@uniroma1.it
Hi marc,

you could use for instance

dim objLoc2 as New arraylist

dim objLoc2 as New List(Of MapPoint.Location)
[Imports System.Collections.Generic]

or similar
....


Marc ha scritto:

Show quoteHide quote
> Hi the below code works fine.
>
> however as i wont always know that the objloc array has 4
> parameters...how can i modify this code so that the array is dynamic??
>
> Sub MapSelectedProperties()
>  Dim objLoc2(1 to 4) As MapPoint.Location
>  Dim i As Integer
>  i = 0
>     Set Recordset = CurrentDb.OpenRecordset("SELECT * FROM
> tblProperties;")
>   If Recordset.RecordCount > 0 Then
>           While Not Recordset.EOF
>            i = i + 1
>            Set objLoc2(i) =
> objMap.FindAddressResults(Recordset!strStreet, Recordset!strCity,
> Recordset!strState, Recordset!strPostalCode)(1)
>         Set objPin = objMap.AddPushpin(objLoc2(i), Recordset!strStreet)
>                         Recordset.MoveNext
>   Wend
>        End If
>           ' objMap.Shapes.AddPolyline objLoc2
Author
14 Dec 2006 10:36 PM
Marc
thanks tommaso,

ive think im in the wrong forum....this is all access vba..i dont think
it suppports array lists?


tommaso.gasta***@uniroma1.it wrote:
Show quoteHide quote
> Hi marc,
>
> you could use for instance
>
> dim objLoc2 as New arraylist
>
> dim objLoc2 as New List(Of MapPoint.Location)
> [Imports System.Collections.Generic]
>
> or similar
> ...
>
>
> Marc ha scritto:
>
> > Hi the below code works fine.
> >
> > however as i wont always know that the objloc array has 4
> > parameters...how can i modify this code so that the array is dynamic??
> >
> > Sub MapSelectedProperties()
> >  Dim objLoc2(1 to 4) As MapPoint.Location
> >  Dim i As Integer
> >  i = 0
> >     Set Recordset = CurrentDb.OpenRecordset("SELECT * FROM
> > tblProperties;")
> >   If Recordset.RecordCount > 0 Then
> >           While Not Recordset.EOF
> >            i = i + 1
> >            Set objLoc2(i) =
> > objMap.FindAddressResults(Recordset!strStreet, Recordset!strCity,
> > Recordset!strState, Recordset!strPostalCode)(1)
> >         Set objPin = objMap.AddPushpin(objLoc2(i), Recordset!strStreet)
> >                         Recordset.MoveNext
> >   Wend
> >        End If
> >           ' objMap.Shapes.AddPolyline objLoc2
Author
14 Dec 2006 10:34 PM
Kerry Moorman
Marc,

Are you trying to convert this VB6 code to VB.Net?

Or are you looking for help with VB6 code?

Kerry Moorman


Show quoteHide quote
"Marc" wrote:

> Hi the below code works fine.
>
> however as i wont always know that the objloc array has 4
> parameters...how can i modify this code so that the array is dynamic??
>
> Sub MapSelectedProperties()
>  Dim objLoc2(1 to 4) As MapPoint.Location
>  Dim i As Integer
>  i = 0
>     Set Recordset = CurrentDb.OpenRecordset("SELECT * FROM
> tblProperties;")
>   If Recordset.RecordCount > 0 Then
>           While Not Recordset.EOF
>            i = i + 1
>            Set objLoc2(i) =
> objMap.FindAddressResults(Recordset!strStreet, Recordset!strCity,
> Recordset!strState, Recordset!strPostalCode)(1)
>         Set objPin = objMap.AddPushpin(objLoc2(i), Recordset!strStreet)
>                         Recordset.MoveNext
>   Wend
>        End If
>           ' objMap.Shapes.AddPolyline objLoc2
>
>