Solved

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

Posted on 2006-07-21
3
176 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now