Thanks for the idea Ben. I can see generally how you're trying to get
around the issue, but sadly I'm a VB type and can't recreate the effect. If
anyone could translate this it'd be much appreciated.

Signature
Rob Oldfield
www.realuk.co.uk
> I was able to do something like this by creating my own
> column style and overriding the Edit method. See below:
[quoted text clipped - 36 lines]
> DataGrid_KeyDown/Up/Press events.
> >Hopefully, I'm just doing something very silly.
Ben Geers - 26 Sep 2003 15:12 GMT
This builds, but it's been a while since I coded vb.net so
bear with me.
Imports System.Windows.Forms
Imports System.Drawing
Public Class DataGridReadOnlyTextBoxColumn
Inherits DataGridTextBoxColumn
Dim m_ReadOnlyRow As Integer
Public Property intReadOnlyRow()
Get
intReadOnlyRow = Me.m_ReadOnlyRow
End Get
Set(ByVal Value)
Me.m_ReadOnlyRow = Value
End Set
End Property
Protected Overloads Overrides Sub Edit(ByVal source As
CurrencyManager, ByVal rowNum As Integer, ByVal bounds As
Rectangle, ByVal cellIsVisible As Boolean)
If rowNum = Me.m_ReadOnlyRow Then
Exit Sub
End If
MyBase.Edit(source, rowNum, bounds, cellIsVisible)
End Sub
End Class
>-----Original Message-----
>Thanks for the idea Ben. I can see generally how you're trying to get
[quoted text clipped - 43 lines]
>
>.
Rob Oldfield - 26 Sep 2003 21:24 GMT
Thanks again Ben. Sadly it's not working for me. I'm adding the column
like this...
Dim ncol As New DataGridReadOnlyTextBoxColumn()
ncol.MappingName = "Broker"
ncol.intReadOnlyRow = 1
Me.DataGrid1.TableStyles(0).GridColumnStyles.Add(ncol)
...and that builds fine and displays the 'Broker' info correctly, but the
Edit event isn't firing. I can edit the broker info in the second row in
this example, and if I add a breakpoint into the Edit code, it never gets
triggered.
One other thing, even if this was working, I still need some more
flexibility. I need to make multiple rows read only depending on other
values in each record (the actual case is I have a column with either Sale
or Purchase - if it's a Sale make the broker editable, if a Purchase then
read only). Going down your suggested road, can I pass the class an array
containing all the row numbers I want to be read only, and will it work if
the user sorts the datagrid?
(Apologies for replying to my own post, but the newsreader I'm using now
isn't showing Ben's second post to this thread. Had to grab it from
Google.)

Signature
For real reply address, lose the cash
www.realuk.co.uk
> Thanks for the idea Ben. I can see generally how you're trying to get
> around the issue, but sadly I'm a VB type and can't recreate the effect. If
[quoted text clipped - 40 lines]
> > DataGrid_KeyDown/Up/Press events.
> > >Hopefully, I'm just doing something very silly.