Solved

is there anyway to set a specific field of a dataset editable

Posted on 2006-07-21
3
179 Views
Last Modified: 2010-04-05
I'm using
   DataSource1.DataSet.Edit;
to set my fields to editable.

A situation has come up where I would like to set a specific field in my table to editable and none of the other ones is this possible and how do I do it?  

So something like
DataSource1.DataField('Fieldname').Edit
0
Comment
Question by:ICPooreman
3 Comments
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 17157040
you can set "ReadOnly" to true on each field
so in your case, you could set them all to false except the one you want to edit
0
 
LVL 4

Accepted Solution

by:
JDSkinner earned 125 total points
ID: 17158041
Hi
Try
procedure TForm1.FormCreate(Sender: TObject);
var iCounter: integer;
    iEditColumn: integer;
begin
    iEditColumn:= 3; // any column to be edited
    for iCounter := 0 to (DBGrid1.Columns.Count-1) do
    begin
        if iCounter <> iEditColumn then DBGrid1.Columns[iCounter].ReadOnly:= true;
    end;
end;
0
 
LVL 9

Expert Comment

by:sun4sunday
ID: 17160831
or you can do it with enable and disable to component like DBEdit. Once it disable, the user cannot edit on that field.
Make disable/Enable depends on the criteria you need.

sun4sunday
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question