我用MDB里的数据生成了一个用ListView做的表,里面有10行和4列,我想求教的是比如在第二行第三列的数据是"123",我如何能在一个Text控件输入要"123",让后按一个Command控件,去找到"123"并且能知道记录在第几行?感谢!!

解决方案 »

  1.   

    with listview
        for i=1 to .ListItems.count
            if .ListItems.SubItems(2)="123" then exit for
        next i
        if i>.ListItems.count then i=0    '如果能找到,i为行值;0代表没有找到
    end with
      

  2.   

    循环listviewr的每一个item,再对每一个item循环找其ListSubItems,进行对比。
      

  3.   

    不行呀!到这里报错if .ListItems.SubItems(2)="123" then exit for
      

  4.   

    我已经懂意思了!你能不能教我怎样循环ListView1的每一个Item
      

  5.   

    Dim itmFound  As ListItem
    Set itmFound = ListView1.FindItem(Text2.Text, lvwText, , lvwPartial)