vb中如何在listview中添加数据?
PrivateSubCommand1_Click()DimxxAsListItemSetxx=ListView1.ListItems.Add(,,"111")xx=Lis...
Private Sub Command1_Click()
Dim xx As ListItem
Set xx = ListView1.ListItems.Add(, , "111")
xx = ListView1.ListItems.Add(, , "222")
xx = ListView1.ListItems.Add(, , "333")
xx = ListView1.ListItems.Add(, , "444")
End Sub
Private Sub Form_Load()
ListView1.View = lvwReport
ListView1.ColumnHeaders.Add , , "第1列", 1000
ListView1.ColumnHeaders.Add , , "第2列", 1000
ListView1.ColumnHeaders.Add , , "第3列", 1000
End Sub
代码如上,最后第一列第一行也就变成444了,下边是222,333,444.
请问,第一行为什么不是111
还有我在Private Sub Command2_Click()中写入什么代码会在第二列第一行输入数据? 展开
Dim xx As ListItem
Set xx = ListView1.ListItems.Add(, , "111")
xx = ListView1.ListItems.Add(, , "222")
xx = ListView1.ListItems.Add(, , "333")
xx = ListView1.ListItems.Add(, , "444")
End Sub
Private Sub Form_Load()
ListView1.View = lvwReport
ListView1.ColumnHeaders.Add , , "第1列", 1000
ListView1.ColumnHeaders.Add , , "第2列", 1000
ListView1.ColumnHeaders.Add , , "第3列", 1000
End Sub
代码如上,最后第一列第一行也就变成444了,下边是222,333,444.
请问,第一行为什么不是111
还有我在Private Sub Command2_Click()中写入什么代码会在第二列第一行输入数据? 展开
1个回答
展开全部
Private Sub Command1_Click()
Dim xx As ListItem
Set xx = ListView1.ListItems.Add(, , "1111")
xx.SubItems(1) = "2222"
xx.SubItems(2) = "3333"
End Sub
Private Sub Form_Load()
ListView1.View = lvwReport
ListView1.ColumnHeaders.Add , , "第1列", 1000
ListView1.ColumnHeaders.Add , , "第2列", 1000
ListView1.ColumnHeaders.Add , , "第3列", 1000
End Sub
Dim xx As ListItem
Set xx = ListView1.ListItems.Add(, , "1111")
xx.SubItems(1) = "2222"
xx.SubItems(2) = "3333"
End Sub
Private Sub Form_Load()
ListView1.View = lvwReport
ListView1.ColumnHeaders.Add , , "第1列", 1000
ListView1.ColumnHeaders.Add , , "第2列", 1000
ListView1.ColumnHeaders.Add , , "第3列", 1000
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询