Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How NOT to select a cell in DGV

SachinthaSachintha Posts: 6Member
In my C# Application program, I have two DataGridViews which are not bound to any data source. I have coded them so that the user is allowed to drag and drop data between the two DGVs as well as within them.
So, when a data item in a cell is dragged and dropped on another cell, the data on the original is deleted - that is set to null.
The problem is, when I do that, after dropping, it automatically select the last cell (the one in which I just set the value to null).
How do I get that cell to be NOT selected?

Here is my code:



dgvSchedule.DoDragDrop(text, DragDropEffects.Copy);
if (bDataDrop == true)
{
dgvSchedule.Rows[info.RowIndex].Cells[info.ColumnIndex].Value = null; //setting the value to null
dgvSchedule.Rows[info.RowIndex].Cells[info.ColumnIndex].Selected = false; //setting that cell to not selected
bDataDrop = false;
}




There, right after I set the value to null, I set the 'selected' property to false, but despite that it still selects that.

Please HELP!
Sign In or Register to comment.