This is a pretty tough one in my opinion...
I have 4 parallel arrays, each increasing as lines are being read from a text file. The four arrays are booktitle, retail value, books on hand, and books on order. I have to find a way to sort all four arrays in ALPHABETICAL ORDER BY TITLE. So, for example, if the second element of the booktitle array was AAA, then that element AS WELL AS THE OTHER ARRAYS CORRESPONDING TO THAT ARRAY (AAA's retail value, AAA's on hand, AAA'S on order) need to be shifted to the first element position. I HAVE to use four parallel arrays so I cannot change that. Any ideas?
Here's the code:
Private Sub mnuItemOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuItemOpen.Click
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
myInFile = File.OpenText(OpenFileDialog1.FileName)
If File.Exists(OpenFileDialog1.FileName) Then
Do Until myInFile.Peek = -1
ReDim Preserve bookTitleArray(bookTitleCounter)
bookTitleArray(bookTitleCounter) = myInFile.ReadLine()
bookTitleCounter += 1
ReDim Preserve retailValueArray(retailValueCounter)
retailValueArray(retailValueCounter) = myInFile.ReadLine()
retailValueCounter += 1
ReDim Preserve booksHandArray(booksHandCounter)
booksHandArray(booksHandCounter) = myInFile.ReadLine()
booksHandCounter += 1
ReDim Preserve booksOrderArray(booksOrderCounter)
booksOrderArray(booksOrderCounter) = myInFile.ReadLine()
booksOrderCounter += 1
Loop
End If
Else
MessageBox.Show("File does not exist.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Sub