Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Ok, so I haven't touched these in a long time and I can't quite recall how to populate them. Here's what I have:

 

I have two digits (say 180 and 200) and need to store the data like (1,180) (2,181) (3,183) etc. How can I dynamically declare the array and populate it like that? I can get the numbers in between, but I need to save it all in an array like that and that's where my memory is foggy.

 

Declare like: Dim arNumber(x, y) As Integer ? Populating the correct coordinates is also where I think I forced myself to forget it all.

 

Many thanks.

Posted

Public Structure MyNumbers
   Public MyNum1 as Integer
   Public MyNum2 as Integer
End Structure

Public Class Class1
    Dim MyArray() as MyNumbers

    Public Sub CreateArray()
       Redim MyArray(3)
       With MyArray(1)
             .MyNum1 = 50
             .MyNum2 = 100
       End With
    End Sub
End Class

Or

Structure ...
Sub ...
Dim MyArray as ArrayList, Data as MyNumbers
Data.MyNum1 = 50: Data.MyNum2 = 100
MyArray.Add(Data)
End Sub
...

If you want to use a "Table"

Dim MyArr(,) as Integer
Redim MyArr(200, 200)
MyArr(156, 234) = 10

.Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...