VB如何向ListView添加数据
单击Command1自动在listview中添加一条数据,并自动清空text中的数据!
最好有详细代码!或发到邮箱:zxt5836@qq.com!谢谢!分数看效果给分! 展开
Private Sub Command1_Click()
Dim xx As ListItem
If Text1.Text <> "" And Text2.Text <> "" And Text3.Text <> "" Then
Set xx = ListView1.ListItems.Add(, , Text1.Text)
xx.SubItems(1) = Text2.Text
xx.SubItems(2) = Text3.Text
Set xx = Nothing
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End If
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