如何知道LISTVIEW是否有被选中的行?我是要在另一个按钮的CLICK事件中判断一个LISTVIEW中是否有被选中的行,如何才能做到呢?

解决方案 »

  1.   


    Private Sub cmdDelete_Click()
        If lstv.ListItems.Count < 1 Then
            MsgBox "列表中没有项目!", vbCritical, "错误"
        Else
            If lstv.SelectedItem.Text = "" Then
                MsgBox "请选择一个项目!", vbCritical, "提示"
            Else
                msgbox "你选中" & lstv.SelectedItem.Text & "项目"
            End If
        End If
    End Sub
      

  2.   

    非常正确。其实MSDN中都可以看到。
      

  3.   

    if not lstv.SelectItem is Nothing then msgbox "选中某行"