To achieve this along with the ClearSelection you will need to set one more property.
To achieve this along with the ClearSelection you will need to set one more property Try this in the DataBindingComplete dataGridView1.ClearSelection(); dataGridView1. CurrentCell = null; EDIT Based on your comments you can modify the code as if (e. KeyCode == Keys.
Up && dataGridView1.CurrentCell. RowIndex == 0) { this. ActiveControl = textBoxPartySearch; dataGridView1.Refresh(); dataGridView1.ClearSelection(); dataGridView1.
CurrentCell = null; e. Handled = true; }.
I am actually filling the datagridview row by row(not databinding it). Where should I put that code? I tried putting it after datagridview has been filled but it did not work!
– Akshay J May 11 at 8:19 I tried adding rows and setting the statement after that .. works for me. Check if you are performing any other action – V4Vendetta May 11 at 8:56 Please see my code. – Akshay J May 11 at 9:06 Yes I have also done in similar fashion, Do you perform any operations after this FillDGV() is called?
It might be something trivial .. check that (I have done this code in Load of the form) – V4Vendetta May 11 at 9:11 OK, I was doing it in the constructor. It works in Load event. But I am using one code to move the focus to top textbox when the first row is selected and the user presses the UP arrow but it does not work.
See my update in question. – Akshay J May 11 at 9:20.
I tried the above methods but nothing worked for me. Finally, I just decided to set the default colors for selected cells to be the same as non-selected cells. Then, in the cell click method, I set them back.
That way nothing appears selected until its clicked, which was sufficient for my application. Here's the code I used in the click method to set everything back to normal: dataGridView. DefaultCellStyle.
SelectionBackColor = SystemColors. DefaultCellStyle. SelectionForeColor = SystemColors.
Window; Annoyingly, the ClearSelection method actually works just fine if I put it in a button, but if I create the control which contains the datagrid, load some data into it, and then try to clear it right then, it doesn't work. I wish I knew why...
Yes, the datagridview is very buggy. Hope MS takes care of it. – Akshay J Jun 9 at 10:12.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.