Solved

DBgrid columns delete

Posted on 1997-10-23
4
892 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

726 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