Solved

DBgrid columns delete

Posted on 1997-10-23
4
816 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 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

21 Experts available now in Live!

Get 1:1 Help Now