Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DBGrid.Columns[x].ReadOnly

201 views
Skip to first unread message

Malcolm

unread,
May 7, 2001, 6:18:22 PM5/7/01
to
Is it possible to set a DBGrid Column to ReadOnly at run-time?

I can do it at design-time but when I try ...

MyDBGrid.Columns[3].ReadOnly := True;

at run-time ... it don't work :o(

Malcolm


Bill Todd (TeamB)

unread,
May 7, 2001, 10:40:21 PM5/7/01
to
Try
MyDBGrid.Columns.Items[3].ReadOnly := True;

The Columns array is zero based. Are you sure that the grid has four
columns?

--
Bill

Brian Bushay TeamB

unread,
May 7, 2001, 11:25:40 PM5/7/01
to

At runtime you need to set the Readonly property of the Tfield the Tcolumn is
attached to.
--
Brian Bushay (TeamB)
Bbu...@NMPLS.com

Malcolm

unread,
May 8, 2001, 3:28:40 AM5/8/01
to
Bill, that does not work either - but see Brian's message.

Malcolm


Malcolm

unread,
May 8, 2001, 3:37:31 AM5/8/01
to
Hi Brian

I have tried your suggestion but can't work out the syntax.
In my manual there is an example on page 19-13:
CustomerCityStateZip.ReadOnly := True;
but when I use the equivalent it comes up Undeclared Identifier.

My Table is "DiveSheetsTable" and my Field is "Board". The Grid Index
is 3 (the fourth of five columns)
As neither of the following is valid
DiveSheetsTableBoard.ReadOnly := True;
DiveSheetsTable.Board.ReadOnly := True;
What do you think is the correct syntax?

Malcolm

Alfred ten Hoeve

unread,
May 8, 2001, 5:49:33 PM5/8/01
to
DriveSheetsTable.Fields[3].ReadOnly := False;

Alfred.


"Malcolm" <malc...@blueyonder.co.invalid> schreef in bericht
news:3af7a23b$1_2@dnews...

Malcolm

unread,
May 8, 2001, 6:09:13 PM5/8/01
to
Hi Bill and Alfred

> DiveSheetsTable.Fields[3].ReadOnly := False;

Thanks, just managed to get that working after all. :o)
Still not sure why it wouldn't do it before. :o(

Many thanks

Malcolm


Alfred ten Hoeve

unread,
May 8, 2001, 7:29:42 PM5/8/01
to
If you use the FieldsEditor for your table and make all fields persistent
(select all fields) then you have a persistent field "DiveSheetTableBoard"
in your DataSource or form's declaration.
If you don't use the FieldEditor, you can set the fieldsproperties only by
their number.

Hope this shines a little light on your question.

Alfred.


"Malcolm" <malc...@blueyonder.co.invalid> schreef in bericht

news:3af86e8f_1@dnews...

Brian Bushay TeamB

unread,
May 8, 2001, 9:19:38 PM5/8/01
to
On Tue, 8 May 2001 08:37:31 +0100, "Malcolm" <malc...@blueyonder.co.invalid>
wrote:

>My Table is "DiveSheetsTable" and my Field is "Board". The Grid Index
>is 3 (the fourth of five columns)
>As neither of the following is valid
> DiveSheetsTableBoard.ReadOnly := True;
> DiveSheetsTable.Board.ReadOnly := True;
>What do you think is the correct syntax?

DiveSheetsTable.fieldbyName('Board').ReadOnly := True;

Malcolm

unread,
May 9, 2001, 3:39:12 AM5/9/01
to
Thanks everyone, it's working now, phew!


0 new messages