ReadOnly DataGrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I want to create a readonly grid.
By this I mean that none of the cells should be editable.

At the moment I have set the readonly property of the grid
to true.

This is OK for 'DataGridBoolColumn' i.e. columns
displaying checkboxes, but for DataGridTextBoxColumn, the
background is greyed out, and a cursor starts blinking in
the cell.

I don't want this cursor to appear at all, and the whole
grid line shuld appear as if the user had clicked the row
header.

I thought there would be an easy way of doing this?


Cheers


Fred.
 
Hi Fred,

since you don't want the user to make any changes to the data in the grid
this should work for you.

\\
private sub GridClickHandler(byval sender as object, byval e as
system.windows.forms.mouseeventargs) handles myGrid.MouseUp

myGrid.Select(myGrid.CurrentCell.RowNumber)

end sub
//

if you're working with editable data and would like the same or a similar
effect then you can get the same effect using the CurrencyManager.Position
property.

hope this helps,

Jim
 
Hi,

You might consider binding a DataView to grid and setting DataView.AllowEdit
= false
 
Back
Top