Hello all,
I want to store about 10 records in a two dimension array. How do I read that data back?
MAC_Array(-1,-1) As String
//Save the data
For i As Integer = 0 to system.NetworkInterfaceCount -1
//Get the NetworkInterface object for the selected item
n = System.GetNetworkInterface(i)
App.MAC_Array(n.MACAddress, "N")
Next i
How to read back? The first element(?) is the MAC, the second is a marker. If the MAC matches something, then I will need to edit the second.
For i = 0 to App.MAC_Array.Ubound -1
If App.MAC_Array(i)
Thank you,
Tim
I’m not sure what you are doing exactly but you need to dimension your array with the bounds of the networkinterface count I believe. Something like the below might work. Not optimized in any fashion. Obviously you would want to store the system.NetworkInterfaceCount-1 in a variable for reuse. Read the array back like it is saved.
dim MAC_Array(-1,-1) As String
redim MAC_ARRAY(system.NetworkInterfaceCount -1, 1)
Dim n as NetworkInterface
//Save the data
For i As Integer = 0 to system.NetworkInterfaceCount -1
//Get the NetworkInterface object for the selected item
n = System.GetNetworkInterface(i)
MAC_Array(i, 0) = n.MacAddress
MAC_Array(i, 1) = "N"
Next i
Maybe something like this:
For i As Integer = 0 To MACArray.Ubound(1) // size of first dimension of array
If MACArray(i, 0) = matchingMAC Then
MACArray(i, 1) = "new value"
End If
Next
Thanks guys!
Your code is very instructive - much appreciated!
Tim