Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > DataGridView: How to remove focus from read-only cells?
 

DataGridView: How to remove focus from read-only cells?

Hi,

In my three-column DataGridView I setthe first two columns to be read-only, only the last column is editable.I also set CellSelect as SelectionMode to enable the user to select any particular cell in the third column. This did not prevent the first and second column's cells from being selectable in the UI, so I execute ClearSelection() whenever a cell from those columns is selected.

However, what remains now is a slight rectangle around the selected cells (the focus?)...

Can I get rid of this, too? What would be the best practice, in general, to have "really" read-only columns that do not react to user clicks in any way (except for the column headers)?

Thank you,

Andy

andy72  Thursday, May 18, 2006 2:20 PM
I have done this before using the CellEnter event. I check to see which column is being entered. If the column is ReadOnly, then I use SendKeys.Send("{TAB}"). I have yet to find a better way to do this.
Aspnot  Monday, May 22, 2006 5:59 PM

You can use google to search for other answers

Custom Search

More Threads

• limit columns in DataGrid
• Override Default Return Key Behaviour in DataGridView
• ErrorProvider is not showing in the first time
• moving datagridViews (that have been bound thru RAD) to other winforms
• How do I get the selected item from a datagrid
• Trying to get a ComboBox to set a value to the currently selected index
• How can I increase the number automatically?
• Datagridview Validation Help
• MVC databinding
• Which forum for: reducing the size of an icon.