Private Sub Command1_Click()
'代码中Text1.Text是一个
文本框用以输入要添加的数据
Dim mIndex As Integer
If List1.ListCount = 0 Then
List1.AddItem Text1.Text
Else
If List1.ListIndex >= 0 Then
mIndex = List1.ListIndex
List1.AddItem Text1.Text, mIndex + 1
Else
List1.AddItem Text1.Text
End If
End If
End Sub
本答案可以直接运行