Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


ListView + Edit Item

sonu_1984sonu_1984 Member Posts: 6
I want to edit the data into the ListView of the first item. when i right click on item..But when i right click selected item not come in edit mode....Plz check it out..

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For lcount As Integer = 1 To 3
ListView1.Items.Add(lcount.ToString, lcount - 1)
End Sub

Private Sub ListView1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseClick
If e.Button = Windows.Forms.MouseButtons.Right Then
Dim ht As ListViewHitTestInfo = ListView1.HitTest(location)
If ht.Location = ListViewHitTestLocations.Label Then
ListView1.LabelEdit = True
End If
End If
End Sub


  • PsightoplazmPsightoplazm Member Posts: 332 ✭✭
    HitTest(location) is refering to what location?
    it seems you should be using e.location rather than location.
  • PsightoplazmPsightoplazm Member Posts: 332 ✭✭
    Also - don't forget you will need to set LabelEdit to false again at some point also - you might want to set in your MouseClick handler before your "if" statement.
Sign In or Register to comment.