So I have an array that stores alphanumeric strings e.g A1-A9, B1-B9 ... F1-F9 etc. The strings are a record item from a file. However due to the nature of the program the items may not be in the specified order as new records are appended to the file. My question is:
if my array looked like this:
SeatingArray(0) = A1
SeatingArray(1) = A6
SeatingArray(2) = A3
could I sort it so that it looks like this:
SeatingArray(0) = A1
SeatingArray(1) = A3
SeatingArray(2) = A6
I was thinking I could use substrings for this but I'm unsure as to how that would allow for a sort. My Array subroutine is below. I want the array sorted so that when the label text value is populated, the strings are in order.
Thanks in advance.
if my array looked like this:
SeatingArray(0) = A1
SeatingArray(1) = A6
SeatingArray(2) = A3
could I sort it so that it looks like this:
SeatingArray(0) = A1
SeatingArray(1) = A3
SeatingArray(2) = A6
I was thinking I could use substrings for this but I'm unsure as to how that would allow for a sort. My Array subroutine is below. I want the array sorted so that when the label text value is populated, the strings are in order.
Thanks in advance.
Sub SeatingArray() Dim i As Integer = 0 Dim SeatingArray(0 To 55) As String Dim seatingString As String = frmTicket.lblSeats.Text FileOpen(1, File, OpenMode.Random, , , Len(Seating)) Do While Not EOF(1) FileGet(1, Seating) If txtCustomerForename.Text = Trim(Seating.CustomerForename) Then SeatingArray(i) = Trim(Seating.SeatIDNumber) frmTicket.lblSeats.Text = frmTicket.lblSeats.Text & SeatingArray(i) & ", " seatingString = frmTicket.lblSeats.Text i = i + 1 End If Loop Dim trimString As String frmTicket.lblSeats.Text = seatingString trimString = frmTicket.lblSeats.Text.Substring(0, frmTicket.lblSeats.Text.Length - 2) frmTicket.lblSeats.Text = trimString FileClose(1) End Sub