?
Solved

creating dbgrid columns at running time

Posted on 2003-03-05
4
Medium Priority
?
210 Views
Last Modified: 2010-04-04
hello,
I cant  create dbgrib columns at running time,
Do any sample that describe it for  me,
 I need these features for my dbgrid columns
1:the change of header column
2:decreament the dataset fields(show less than dataset fields)

any one have a sample for this work?

Thanks
m.reza
0
Comment
Question by:Imbeginner
[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 6

Accepted Solution

by:
Hardi earned 200 total points
ID: 8077467
Hi

You can access each column using DBGrid1.Columns[index]
For example:
DBGrid1.Columns[0].Title.Caption := 'First';
DBGrid1.Columns[1].Visible := False;

Does that help?
0
 

Expert Comment

by:da-vinci
ID: 8077532
Also creating is quite easy:

Delphi syntax:
function Add: TColumn;

Description
Add returns the new column.

After you have created the new column you can edit any property you like by using the index.
The column you added has always the following itemindex:
DBGrid1.Columns[DBGrid1.Columns.Count-1]

0
 
LVL 9

Expert Comment

by:ginsonic
ID: 8077742
Simple:

Grid1.Columns.Add.FieldName:='MyColumn'; // My name
Grid1.Columns.Add.Width:=250;  //My width
0
 

Author Comment

by:Imbeginner
ID: 8101993
thanks for your good answer
0

Featured Post

Independent Software Vendors: 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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

800 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