
Private Sub Command1_Click()
Dim i As Long
For i = 0 To List1.ListCount - 1
List1.List(i) = i+1 &"." &List1.List(i)
Next
End Sub
补充:你又没有说明你的程序的具体情况,怎么给你说?总之我的代码在我这里是测试通过的
如果你是想在新增数据时添加序号,可以这样:
List1.AddItem List1.ListCount + 1 &"." &"要添加的行内容"
Private Sub Form_Load()Dim i As Integer, j As Integer, n As Integer
Randomize
List1.Clear
For i = 0 To 19
n = Int(Rnd * 90) + 10
For j = 0 To List1.ListCount - 1
If n <List1.List(j) Then Exit For
Next
List1.AddItem n, j
Next
For i = 0 To List1.ListCount - 1
List1.List(i) = i + 1 &". " &List1.List(i)
Next
End Sub
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)