Keeping Cells from getting Focus?

J

Josh Grameson

I have a datagridview with some row that I want only to display. Which is
fine cause I make them readonly. But I would like that you can't land in
those cells as well. Is this possible?
 
K

Ken Cox - Microsoft MVP

A control with an tabindex value of minus one (-1) is passed over in the tab
sequence.

Is there a way you can put this in as an attribute for the control?

tabindex="-1"
 
J

Josh Grameson

I understand that each control has a tabindex. But in this case wouldn't the
control be the DataGridView itself, not the individual cells? I don't want
to avoid focus to any of the DataGridView cells but to certain columns.
 
E

Eliyahu Goldin

You heed to handle either ItemDataBound or PreRender event. In the event
handler you can access individual rows and their cells. Set Enabled=false
for the cells you want to disable.

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top