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

这个插入对他们的名字进行了排序,但我还需要使用他们的 DOB 和他们的等级,我应该在我的 Visual Basic 代码中的哪个位置放置这个?

4

1 回答 1

2

只要移动starname的元素,就可以移动DOB和Rank的对应元素。

于 2013-02-10T07:34:43.513 回答