Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataGridView 1

Status
Not open for further replies.

jbenson001

Programmer
Jan 7, 2004
8,172
US
When using the datagridview in .NET 2.0, the first row is selected by default. I would like the grid to appear with no rows being selected. I looped through the rows colletion and set the selected property to false for each row, however, the first row is always showing as selcted. Is there anyway to show the grid with no rows selected by default?

Thanks,

Jim
 
If that didn't work, then you may have something else selecting the cell. Post your code so we can see what's going on.

Also, make sure that the currentcell method is the last method called before returning control back to your gui and make sure that your datagrid is not getting focus.
 
I think the problem is that I have the grid on a tab page. Also, there is another grid that is related. So when the first grid loads, the selectedindexchanged event fires and the related grid is populated. Your code works if I put it in the click event of the tab control. Is there a way to stop the selectedindexchanged event from firing then the first grid loads?

Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top