Solved

Edit Records from DBGrid

Posted on 2002-07-10
3
240 Views
Last Modified: 2010-04-04
Im just new in Delphi Programming so I hope somebody could help me with this. How do I link a DBEdit box and combobox to a DBGrid columns(which is connected to a database) so as when I click a record from the dbgrid I can edit or delete that record using the editbox, combobox and command buttons. I also need to add records by clicking an ADD button and the type the the data in the edit boxes and combo boxes. And also, I want to restrict the user to type anything in the DBGrid, I want all editing in the editboxes, how do I do this? Hope somebody could help me. Thanks.
0
Comment
Question by:sharol
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 150 total points
ID: 7145162
use the same datasource for the grid and your dbedits,
set the grid readonly (property)

you could use three buttons

edit-method=datasource1.dataset.edit;
new-method=datasource1.dataset.insert; //or append

//following is only available, if edited or new
save-method=datasource1.dataset.post;
maybe-cancel-method=datasource1.dataset.cancel;

you could also use a tdbnavigator for this
(just connect it to the same datasource)

hope this helps

meikl ;-)

0
 

Author Comment

by:sharol
ID: 7145287
is this also possible if the list/items of the combo box is coming from another table?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7148641
yes,

you could use a tdbcombobox or a tdblookupcombobox

by the tdbcombobox you've to fill the entries at appstart

meikl ;-)
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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

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