?
Solved

DBgrid columns delete

Posted on 1997-10-23
4
Medium Priority
?
1,021 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 600 total points
ID: 1348741
Thanks RONIT you have the response for my problem.
1

Featured Post

Industry Leaders: 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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

755 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