How to get row and column index when I double click (or some other event) of a cell on a ListView?

Mitja, why do you want to let a ListView behave like a DataGridView?
Just use a DataGridView as I already suggested to you in a previous thread.
A programmer must be able to leave a programming idea when it leads to too many complications and (how hard it may seem) start from scratch all over again. I did, there are many others...

Thx for convincing me to use the dgw. I was thinking for 2 days what to do, or to stay on ListView or to go on dgw. Now I finally made my mind and I will change it right now.
btw, can I ask you how to get row and column indexes in DGW?

DGV is a large class, it took me some time to get used to it, but once you do it is "a piece of cake".
You can acces a cell in a DGV like this:
this.dataGridView1.Rows[rowIndex].Cells[colIndex].Value = "Avalue";
or like this:
this.dataGridView1[colIndex, rowIndex].Value = "Avalue";
If you look here at DaniWeb you may find more elaborate examples, or google. Succes!

Sorry, but this is not what I want. I would like to get row and column indexes when I click on a cell. Lets say that before clicking I do not know the indexes. And after I double click (or maybe any other event), I need to get index for row and index for column.

Because I need to save this two indexes for each cell into database, if I want to show the value right there, in the same cell where I entered it.

This is how I got indexes for a cell:
In the DGW CellDoubleClick event I did:

int rowIndex = e.RowIndex;
int colIndex = e.ColumnIndex;

Got it. Thread salved!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.