Private Sub listStock_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles listStock.DoubleClick
proID.Text = listStock.FocusedItem.SubItems(0).Text
proName.Text = listStock.FocusedItem.SubItems(1).Text
Stock.Text = listStock.FocusedItem.SubItems(2).Text
End Sub
Private Sub listStock_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles listStock.DoubleClick
Dim myListView As ListView = DirectCast(sender, ListView)
proID.Text = myListView.FocusedItem.SubItems(0).Text
proName.Text = myListView.FocusedItem.SubItems(1).Text
Stock.Text = myListView.FocusedItem.SubItems(2).Text
End Sub
Private Sub ListView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick
If ListView1.Items.Count = 0 Then Exit Sub
TextBox4.Text = Trim(ListView1.FocusedItem.SubItems(1).Text.ToString())
TextBox5.Text = Trim(ListView1.FocusedItem.SubItems(3).Text.ToString())
TextBox6.Text = Trim(ListView1.FocusedItem.SubItems(4).Text.ToString())
End Sub
หรือแบบนี้ก็ได้ครับ
Tongspy2 (VB.NET)
Private Sub ListView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick
If ListView1.Items.Count = 0 Then Exit Sub
TextBox4.Text = Trim(ListView1.FocusedItem.SubItems(1).Text)
TextBox5.Text = Trim(ListView1.FocusedItem.SubItems(3).Text)
TextBox6.Text = Trim(ListView1.FocusedItem.SubItems(4).Text)
End Sub