How to set the focus of the cells of gridview

Posted by Santosh4u under VB.NET on 10/19/2010 | Points: 10 | Views : 10163 | Status : [Member] | Replies : 3
hi all
can any body plz tell me how to set focus of cells of gridview.

Ex: There are 10 rows and 5 columns of my grid view .
out of 5, first 3 columns are read only,
so after entering the value of 5 th column/cell of 1st row ,if i click tab then fucus should goes to 2nd rows of 4th column.

i m working on windows application and vb.net



Regards
Santosh




Responses

Posted by: T.saravanan on: 10/20/2010 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi Santhosh,

Try the following code for Cell Focus
dataGridView1.CurrentCell = dataGridView1[ColumnIndex, RowIndex]; 


But You can set the correct RowIndex & ColumnIndex for that Cell focus.
Just check the cell readonly property for that cell using CellBeginEdit Event,if the cell is readonly means goto the next Column (or) next Row .

Cheers :)

Thanks,
T.Saravanan

Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lalji_mer on: 10/20/2010 [Member] Bronze | Points: 25

Up
0
Down
Hi,
try following link.

http://forums.asp.net/p/1496385/3529013.aspx

LP MER

Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santosh4u on: 10/20/2010 [Member] Bronze | Points: 25

Up
0
Down
Hi Lalji_mer

this link is for web application but i maintained that i m working in windows application.
if u have idea abt windows then let me know....

Regards
Santosh


Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response