Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Code Project to my rescue - again! Greetings everyone.

I have a ListView on my form which has the following columns :
Qty to Receive
Qty Ordered
Qty Received
Qty Outstanding

and others which are not applicable here.

I have set the LabelEdit property to True and have the following event :

VB
Private Sub lsv_GRV_DoubleClick(sender As Object, e As System.EventArgs) Handles lsv_GRV.DoubleClick
    lsv_GRV.SelectedItems(0).BeginEdit()
End Sub


This allows the user to doubleclick on the first column (Qty to Receive) of any number of rows, and enter a value.

What I am really battling with is retrieving that value so that I can adjust the 'Qty Received' value and the 'Qty Outstanding' value with simple arithmetic.

All the events that I have tried (and that's just about all of them) only return the value that was in the selected item before the double click (which is always null).

Therefore, in a nutshell, how can I immediately retrieve the value that a user has entered after double clicking on an item.

Any assistance would be much appreciated.
Posted

1 solution

Use the AfterLabelEdit event and the "Label" property of the event argument "e".

VB
Private Sub ListView1_AfterLabelEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.LabelEditEventArgs) Handles ListView1.AfterLabelEdit
   MsgBox(e.Label)

End Sub
 
Share this answer
 
Comments
Darrell de Wet 30-May-13 2:28am    
Brilliant. Thanks a lot. You taught me something that has been bothering me for a while.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900