Results 1 to 3 of 3

Thread: [02/03] Pass and return a 2 dimentional array

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Location
    Devon - UK
    Posts
    214

    [02/03] Pass and return a 2 dimentional array

    Guys

    I need to pass a two dimentional array to a funtion - work on it and return the array results. I can achieve it with a one dimentional array but I'm having problems with 2.

  2. #2
    Frenzied Member Icyculyr's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    1,934

    Re: [02/03] Pass and return a 2 dimentional array

    vb.net Code:
    1. Public D2Array(,) As String = {}
    2. Public Function Take2D(ByVal strArray(,) As String) As String(,)
    3.     'Work
    4.     Return strArray
    5. End Function
    6.  
    7. Private Sub My_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
    8.     D2Array = Take2D(D2Array)
    9. End Sub

    That should work, I use VB.net, so the syntax might be a bit different.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Location
    Devon - UK
    Posts
    214

    Re: [02/03] Pass and return a 2 dimentional array

    Thanks for that.

    The problem was :-

    HTML Code:
       Structure OSMTileName
    
            Public OSMColumn As Integer
            Public OSMTile As Integer
            Public Name As String    ' Tile Name
            Public OSMTileDetails As TileDetails
    
        End Structure
    
        Structure TileDetails
    
            Public X As Double       ' Lon
            Public Y As Double       ' Lat 
            Public Height As Double  ' Lon span 
            Public Width As Double   ' Lat span
    
        End Structure
    HTML Code:
        Private Sub LoadMapGrid(ByRef ThisArray As Array, ByVal Lat As Double, ByVal Lon As Double, ByVal z As Integer)
    I changed it to:-

    HTML Code:
        Private Sub LoadMapGrid(ByRef ThisArray(,) As OSMTileName, ByVal Lat As Double, ByVal Lon As Double, ByVal z As Integer)

Posting Permissions

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



Click Here to Expand Forum to Full Width