3Dees 0 Newbie Poster

Hi,
i have bieng trying to write a method which takes a listbox index (1D array) and find the corresponding 2D index. I did this code with some help which get the 1D index of a 2D array. Now i need to do the reverse from listbox index (1D) and get the corresponding 2D index (row, col).

Public Function MatrixIndexToVector(ByVal row As Integer, ByVal col As Integer) As Integer

ReDim temp(row, col)
Dim index As Integer

For row = 0 To temp.GetUpperBound(0)
For col = 0 To temp.GetUpperBound(0) - 1

temp(row, col) = index
index += 1
Next col
Next row
Return index
End Function

pointers??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.