Dim itmX As ListItem
Set itmX = ListView.ListItems.Add
itmX.SubItems(1) = rsallsort!price
大概是这样吧!!

解决方案 »

  1.   

    DataGrid不太好用
    所以我想用ListView
    有人知道怎么用吗
      

  2.   

    listview不支持绑定,你又怎么绑定?除非自己写一个控件
      

  3.   

    那么怎样才能让表中的数据在ListView中显示呢?
    (象DataGrid那样)
      

  4.   

    没有人知道吗?
    怎样才能让表中的数据在ListView中显示呢?(象DataGrid那样)
      

  5.   

    干吗非要绑定,多不灵活呀。
    lvw.listitem.subitem(i)=rs.field1.value
      

  6.   

    Public Sub RecordSetToListView(RSName As ADODB.Recordset, LName As ListView)       '指定的
    On Error Resume Next
        Dim i As Integer
        Dim j As Integer
        Dim k As Integer
        LName.Sorted = False
        RSName.MoveFirst
        For i = 1 To RSName.RecordCount
            LName.ListItems.Add , , RSName.Fields(0).Value
                For j = 1 To RSName.Fields.Count - 1
                  If IsNull(RSName.Fields(j).Value) Then
                      LName.ListItems(i).SubItems(j) = ""
                  Else
                      LName.ListItems(i).SubItems(j) = RSName.Fields(j).Value
                  End If
                Next j
            RSName.MoveNext
        Next i
        LName.Refresh
    End Sub
      

  7.   

    不一定要绑定我就想让表中的数据象在DataGrid中显示的那样在ListView中显示出来
      

  8.   

    Public Sub RecordSetToLVHeader(RSName As ADODB.Recordset, LName As ListView)       '从记录集到列表头
    On Error Resume Next
        Dim i As Integer
        LName.ColumnHeaders.Clear
        RSName.MoveFirst
        For i = 0 To RSName.Fields.Count - 1
            LName.ColumnHeaders.Add , , RSName.Fields(i).Name
        Next i
    End Sub
      

  9.   

    Private Sub List_Init()
    ListView1.ColumnHeaders.Add 1, , "人员名称", 160
    End Sub'填充List的条目
    Private Sub List_Input()
    Dim i As Integer
    Dim phsbz As String
    With RS_temp
       If .State = adStateOpen Then
          .Close
       End If
       .ActiveConnection = adoCN
       .CursorLocation = adUseClient
       .CursorType = adOpenForwardOnly
       .LockType = adLockReadOnly
       .Source = "select staffname from users "
       .Open
       'List_Clear
       If .BOF = False And .EOF = False Then
          '有记录
          i = 1
          Do While .EOF = False
             ListView1.ListItems.Add , , .Fields("staffname").Value
             i = i + 1
             .MoveNext
          Loop
       End If
    End With
    End Sub
      

  10.   

    to:malarfno(malarfno) LName.ColumnHeaders.Add , , RSName.Fields(i).Name
    这句报错啊
      

  11.   

    你可使用MSHFlexGrid控件,它支持绑定
      

  12.   

    你察看一下变量好了,有这一句On Error Resume Next应该会跳过错误的吧
      

  13.   

    你把程序贴出来或者发我信箱,我帮你调 [email protected]