-
Read Only DataGrid
I'm using a DataGrid in a Winforms project to display the results of a
search. All I want the user to be able to do is to double-click somewhere on
a row in the grid and then I will display the detail associated with the row.
I've set the grid columns ReadOnly property which still allows the user to
enter/change the data in the cell, but restores the original data as soon as
the user leaves the cell.
I want to prevent the user from being able to enter/change the data in the
cell, which means I've got to trap the KeyPress event for each column and eat
the input by setting e.Handled = True.
I downloaded the DataGridDigitsTextBoxColumn project in the Winforms info on
syncfusion.com. My concern is the component inherits DataGridTextBoxColumn
and invokes a form of the constructor, Public Sub New(PropertyDescriptor,
String, Boolean), that is documented as "This member supports the .NET
Framework infrastructure and is not intended to be used directly from your
code." Microsoft is telling us that if we use this constructor, they reserve
the right to change/remove it in the future and we are up a creek without a
paddle.
I can accept that risk if that is the only way to accomplish what I want to
do. Is this the only way to eat all input in the cells in a DataGrid?
Thanks,
Bob
-
Re: Read Only DataGrid
G'day Bob.
>I've set the grid columns ReadOnly property which still allows the user
>to enter/change the data in the cell, but restores the original data as
>soon as the user leaves the cell.
<Snip/>
>Is this the only way to eat all input in the cells in a DataGrid?
You say that you have set the column's ReadOnly property? Try setting the
ReadOnly property for the grid itself, instead.
HTH,
Cheers,
Paul
-
Re: Read Only DataGrid
In article <3d48be44$1@10.1.10.29>, paulmc@nospam.thehub.com.au says...
>
> G'day Bob.
>
> >I've set the grid columns ReadOnly property which still allows the user
> >to enter/change the data in the cell, but restores the original data as
> >soon as the user leaves the cell.
> <Snip/>
> >Is this the only way to eat all input in the cells in a DataGrid?
>
> You say that you have set the column's ReadOnly property? Try setting the
> ReadOnly property for the grid itself, instead.
>
>
> HTH,
> Cheers,
> Paul
Paul,
Thanks! I'm not sure how I missed that property:-( When I first looked at the
DataGrid, I thought it was strange that there was no ReadOnly property, but
given all the stuff that MS left out of the grid, I figured that I was
supposed to make each column ReadOnly.
Bob - feeling extremely embarrassed
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|