Click here to Skip to main content
15,881,690 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when I write this code
GridViewPays.CurrentCell = GridViewPays.Rows[1].Cells[0];
it selects the second row
but when I change indexrow to 0
GridViewPays.CurrentCell = GridViewPays.Rows[0].Cells[0];
it doesn't work
what' the problem? I have number sequence column in same datagridview
Posted
Comments
j snooze 31-Jul-14 14:59pm    
I did a basic form with a gridview and setting the current cell to Rows[0].Cells[0] worked for me. Not sure what "doesn't work" means. Does it error or just not select the current cell?
frostcox 31-Jul-14 17:25pm    
When you say doesn't work what do you mean? Do you get an error or is there no value in that cell?
[no name] 1-Aug-14 1:01am    
Please paste the error here, if you are getting one.

1 solution

try
GridViewPays.Rows[0].Selected = true;


Find more here[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900