I have a datagridview that is bound to a SQLite database. Now, I wish to modify some fields in the datagridview.
There are 4 TEXT columns – Timestamp, Message, Type , Hash.
Now I find a row, I want to right click it.. And it should have to option – “include” .. So, when i click include in the context menu, the Type column of my DGV should change to “include” from whatever it previously was… (I don’t want it be enabled to edit.. I just want it to change within the program) How do i get the index where I have clicked and access that particular cell to modify it??
This code does what you want:
I couldn’t think of a better method of informing the context menu which row was selected than actually using the selected row property of the DataGridView – you could also store this in a class level field, but I don’t think that is quite as tidy.