I am looking to create an editable ListView in a C# winforms application where a user may double click on a cell in order to change its contents. It would be great if someone could provide my with some guidance and/or an example. I am not looking to use any commercial products.
You could use the listview's DoubleClick event, and when it is called, you would open a new form where the user would enter a new value for the selected item. Then when the user has pressed ok, you would edit the value of the specific item to what the user has entered.
You can enable inline editing of ListView items in C# simply by setting ListView's LabelEdit property to True (all ideas from this article also work in VB.NET after corresponding syntax changes): listView1. LabelEdit = true; But you cannot enable editing of ListView subitems by setting a similar property.
How do I make an editable ListView item? Use TextField instead of Text Widget & pass Dynamic data as Initial data - then on edit enable that TextField & edit Text. thanks, but TextField is editable anyway. when user clicks accidentally it can enter any text.
You're asking the wrong question :)
A ListView is not the correct control. Use the DataGridView control. It can be configured to look just like a ListView, but it supports in-place editing of cells.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With