I have a ListView in my application with four columns. I want to edit two of them, one is text field and other one is date field. The other two should not be edited. And I want to write code in EditToolStripMenuItemClick event, or any other event (possibly).

Can it be done?

I went through this link http://www.codeproject.com/KB/list/ListViewCellEditors.aspx[^] but could not find satisfactory answer.

What was not satisfactory about it? I looked over the code, and it seems to accomplish what you state in your post.

The other alternative is to trap what row in the ListView the user clicked, then provide a DatePicker and/or a TextBox and a "Commit" button that you fill with the data from the clicked row. Let the user edit the data, and when they press the button, put the edited data back into the ListView.

Or, you could switch to a DataGridView. It's a bit more complex than a ListView, but it's easier to set up editing of the cells. When you set up the columns in the DataGridView, you can specify if they are ReadOnly - thereby meeting your criteria of only some of the columns being editable.

I strongly recommend you to switch to dataGridView - this is especially important when it comes to editing columns. ListView is so clumsy on this area. really. DGV is a far way better control. ListView is only meant to show data, not to edit it, even if its possible.
And besides, I doubt that its possible to create columns as disabled in listView - just as far as I have worked with it.
Hope it helps,

This article has been dead for over six months. Start a new discussion instead.