1

この挿入ソートについて少し助けが必要です。これまでのコードは次のとおりです。

Private Sub SortedList_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim currentitem As Integer = 2
    While currentitem <= numitems
        currentdataitem = frmEntry.starname(currentitem)
        comparison = 1
        finish = False
        While comparison < currentitem And finish = False
            If currentdataitem < frmEntry.starname(comparison) Then
                shuffleitem = currentitem
                While shuffleitem > comparison
                    frmEntry.starname(shuffleitem) = frmEntry.starname(shuffleitem - 1)
                    shuffleitem = shuffleitem - 1
                End While
                frmEntry.starname(comparison) = currentdataitem
                finish = True
            End If
            comparison = comparison + 1
        End While
        currentitem = currentitem + 1
    End While
    arrayindex = 0
    For Me.arrayindex = 1 To numitems
        lstsorted.Items.Clear()
        lstsorted.Items.Add(frmEntry.starname(arrayindex))
        lstsorted.Items.Add(frmEntry.DOB(arrayindex))
        lstsorted.Items.Add(frmEntry.rank(arrayindex))
    Next
End Sub

この挿入により名前が並べ替えられますが、生年月日とランクも一緒に取得する必要があります。Visual Basic コードのどの時点でこれを挿入すればよいでしょうか?

4

1 に答える 1

2

starname の要素を移動するたびに、DOB と Rank の対応する要素を移動できます。

于 2013-02-10T07:34:43.513 に答える