我需要对此插入排序提供一些帮助,到目前为止我的代码是:
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和他们的等级用在它上面,在我的视觉基本代码中,我把它放在什么位置?
答案 0 :(得分:2)
每当移动starname元素时,您都可以移动DOB和Rank的相应元素。