Hi there,
I have a strange problem with a RightClick Event in my DataGridView.
When you right click on a row in my datagridview, a contextmenustrip is shown where the User can select some items, e.g in one column are folder paths and one item of the contextmenustrip is to open the explorer.exe with this path.
I start the application with 3 rows and I do a rightclick on the second or third row and select to open the Folder, it's the value from the first row (folder path) what is opened in my explorer.exe.
So i have first to left click on a row and afterwards rightclick, to get the correct value from this row.
For the rightClick Event a have the following snippet to select the row and open the contextMenuStrip
if (e.Button == MouseButtons.Right)
{
var hit = dgv_overAll.HitTest(e.X, e.Y);
dgv_overAll.ClearSelection();
dgv_overAll.Rows[hit.RowIndex].Selected = true;
cMS_dataGridView.Show();
}
This is the Event from the ContextMenuStrip where i open the explorer:
Process.Start("explorer.exe",dgv_overAll.CurrentRow.Cells[2].Value.ToString();
The row where I perform the rightclick is getting a blue background, so it must be the selected row, isn't is? But why do i get the wrong value? (The value from the last selected row)
I really don't now...
Thanks in advance