Hi There

I am using the code to pop up a a contextmenu on a datagrid. When grid is
populated for the first time the first columns/row is selected. The moment I
right click on another row the new row is highlighted as well as the first
column. Now what happens this code (int i = dgCleaning.CurrentRow.Index;)
gives me the index of the first row. I have set Multiselect = false? What am
I doing wrong?

thx for ur time

Code:
 private void dgCleaning_CellMouseClick(object sender,
DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex >= 0 && e.ColumnIndex >= 0 && e.Button ==
MouseButtons.Right)
            {
                dgCleaning.Rows[e.RowIndex].Selected = true;
                Rectangle r =
dgCleaning.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true);
                contextMenuCleaning.Show(dgCleaning, r.Left + e.X, r.Top +
e.Y);
            }
        }

-- 
----------------------------------------
Kamnandi Web Hosting
http://www.kamnandi.co.za
-------------------------------------------

Reply via email to