vb listview 控件如何对某行某列编辑 请指教
1个回答
展开全部
’以下是ListView的使用方法示例,不明白的HI我
Private Sub Form_Load()
Dim Test(6) As Integer, i As Integer
For i = 0 To 6
Test(i) = i + 1
Next i
ListView1.View = lvwReport
'初始化ListView
ListView1.ColumnHeaders.Add , "red", "红色"
ListView1.ColumnHeaders.Add , "id1", "一号"
ListView1.ColumnHeaders.Add , "id2", "二号"
ListView1.ColumnHeaders.Add , "id3", "三号"
ListView1.ColumnHeaders.Add , "id4", "四号"
ListView1.ColumnHeaders.Add , "id5", "五号"
ListView1.ColumnHeaders.Add , "blue", "蓝色"
ListView1.ColumnHeaders.Add , "id7", "一号"
ListView1.ColumnHeaders.Add , "id8", "二号"
'增加项目
Dim itmX As ListItem
Set itmX = ListView1.ListItems.Add(1, "", "红")
For i = 0 To 6
itmX.SubItems(i + 1) = Test(i)
Next i
itmX.ListSubItems(6).ForeColor = vbBlue
itmX.ListSubItems(ListView1.ColumnHeaders("blue").SubItemIndex).ForeColor = vbBlue
'上面两种访问是一样的
End Sub
Private Sub Form_Load()
Dim Test(6) As Integer, i As Integer
For i = 0 To 6
Test(i) = i + 1
Next i
ListView1.View = lvwReport
'初始化ListView
ListView1.ColumnHeaders.Add , "red", "红色"
ListView1.ColumnHeaders.Add , "id1", "一号"
ListView1.ColumnHeaders.Add , "id2", "二号"
ListView1.ColumnHeaders.Add , "id3", "三号"
ListView1.ColumnHeaders.Add , "id4", "四号"
ListView1.ColumnHeaders.Add , "id5", "五号"
ListView1.ColumnHeaders.Add , "blue", "蓝色"
ListView1.ColumnHeaders.Add , "id7", "一号"
ListView1.ColumnHeaders.Add , "id8", "二号"
'增加项目
Dim itmX As ListItem
Set itmX = ListView1.ListItems.Add(1, "", "红")
For i = 0 To 6
itmX.SubItems(i + 1) = Test(i)
Next i
itmX.ListSubItems(6).ForeColor = vbBlue
itmX.ListSubItems(ListView1.ColumnHeaders("blue").SubItemIndex).ForeColor = vbBlue
'上面两种访问是一样的
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询