Solved

DBgrid columns delete

Posted on 1997-10-23
4
868 Views
Last Modified: 2010-04-04
I want to delete a columns in a DBgrid with Delphi2 in run-time mode.
Add a columns is possible : DBgrid.columns.add
This command add a columns at the end of the dbgrid.
How to delete this last columns ?
The command DBgrid.columns.del or erase don't work.
Thanks.
0
Comment
Question by:lgc5800
4 Comments
 
LVL 3

Expert Comment

by:Pegasus100397
ID: 1348738
Lgc,

As opposed to actually deleting the column, how about just setting it's visible property to FALSE, thereby hiding it but keeping it "available" for program usage or possible re-display later?

DBGrid.Columns[2].Visible := False;

Good luck with your project!
Pegasus
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1348739
Sorry, but DBgrid.columns.visible := false and RebuildColumns don't work with persistant field in my program.
Thanks Pegasus and Zifnab.

0
 

Author Comment

by:lgc5800
ID: 1348740
1. Place a DBGrid on a form.
2. Place a button on a form.
3. Connect the DBGrid to a table that has more then 2 fields.
4. Set Table's Active to true.
5. Write the following code, that deletes the second column:

procedure TForm1.Button1Click(Sender: TObject);
begin
  DBGrid1.Columns.RebuildColumns;
  DBGrid1.Columns.Items[1].Destroy;
end;

0
 
LVL 5

Accepted Solution

by:
ronit051397 earned 200 total points
ID: 1348741
Thanks RONIT you have the response for my problem.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Title # Comments Views Activity
Delphi - replicating a form 8 92
Twebbrowser add css to the header 3 39
Firemonkey Tcameracomponent resultion 1 23
Way to create an iPhone app for my customers 8 45
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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

749 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