我现在遇到的问题是什么呢?我的listview里显示的数据是我从数据库里读取出来的,总共两列数据。
设置ListView的属性是:
点击这个控件,按右键出现的地方设置,View:lvwReport,复选框里只有;HideSelection,LabelWrap,Enabled,Gridlines选中。
添加到ListView里的代码是这样的:
Dim rstGd As ADODB.Recordset
Dim curid As Integer
Dim numPeople As Integer
curid = iHitKey
numPeople = 0
Set rstGd = g_Conn.Execute("SELECT TPName,TPPeopleNum FROM ClassTable WHERE treecID=" + CStr(curid) + "")
Do While Not rstGd.EOF
With lvListView
.ListItems.Add
.ListItems(.ListItems.Count).Selected = True
With .SelectedItem
.Text = Trim(rstGd.Fields("TPName"))
numPeople = numPeople + rstGd.Fields("TPPeopleNum")
.SubItems(1) = CStr(rstGd.Fields("TPPeopleNum"))
End With
rstGd.MoveNext
End With
Loop
lvListView.ListItems.Add
lvListView.ListItems(lvListView.ListItems.Count).Selected = True
lvListView.SelectedItem.Text = "总人数"
lvListView.SelectedItem.SubItems(1) = CStr(numPeople)
rstGd.Close
Set rstGd = Nothing
显示出来的第二列,鼠标单击不能进入。
请问什么原因?