Change order of DBGrid-columns (runtime!)

Posted on 1998-10-02
Last Modified: 2010-04-06
I am developping a adress-database-application. I want to change the order (sequence) of the columns during runtime. How can I fix that ???
Question by:roosiedb
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
  • 3
  • 2

Expert Comment

ID: 1341539
Hi roosiedb,

what about this? : Table1.Field[4].index:=0 (this will move it to column 0 in the DBGrid)

Regards, Zif.

Author Comment

ID: 1341540
Sorry, that won't work (maybe because I am using Delphi 3.0 ???).
Please help me with this...

Accepted Solution

ZifNab earned 20 total points
ID: 1341541
Hi rooSiedb,

juSt tried it on my D3, and it SeemS to work, probably it haS to do with my miStype :-)). here iS the correct Source. Sorry for any inconvinianceS.

procedure TForm1.Button1Click(Sender: TObject);
 Table1.Fields[4].index :=1

RegardS, Zif.

Author Comment

ID: 1341542
Sorry, your answer really did not work. That was because you forgot the S in fieldS...

DBGrid1.Fields[0].Index := 2;

And I did not see the difference myself. When I copied and pasted your answer into my Delphi-application, it did not work at all. That's why I rejected your answer.
Now that you've found the error in your answer, I have fixed my problem.
Next time: watch your spelling please... I am a beginning Delphi-programmer and I don't know how to spell all these Delphi-terms myself yet, because I did not use this one before... Anyway, thank you very much for helping. I will increase and grade the answer now. Bye. J.v.Barchum.

Expert Comment

ID: 1341543
no problem...  I'll try to do my best with the syntaxes. But after all E-E is intended to communicate with each other. So, these errors aren't a world-crime... except the time you lose with it... thanks! c.u. ZiF.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
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
Course of the Month7 days, 17 hours left to enroll

617 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