VB.NET 获取ListView被鼠标选中的项的某列内容

Private Sub ListView2_ItemSelectionChanged(sender As Object, e As System.Windows.Forms.ListViewItemSelectionChangedEventArgs) Handles ListView2.ItemSelectionChanged
    If e.IsSelected Then TextBox1.Text = e.Item.SubItems(1).Text '文本框显示鼠标选择项第二列内容
End Sub

发现百度知道关于这方面的回答没一个对的,连事件都用错,基本都去用SelectedIndexChanged事件。

ItemSelectionChanged will return the instance of the item who’s selection has changed, where as SelectedIndexChanged will just notify you that a selection change was made. It won’t tell you which item changed.

你可能感兴趣的:(vb-net)