ReadOnly DataGrid

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.
 
J

jim

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
 
M

Miha Markic

Hi,

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

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

Top