Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 789
  • Last Modified:

Change order of DBGrid-columns (runtime!)

Help...
I am developping a adress-database-application. I want to change the order (sequence) of the columns during runtime. How can I fix that ???
Thanx.
J.v.Barchum.
0
roosiedb
Asked:
roosiedb
  • 3
  • 2
1 Solution
 
ZifNabCommented:
Hi roosiedb,

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

Regards, Zif.
0
 
roosiedbAuthor Commented:
Sorry, that won't work (maybe because I am using Delphi 3.0 ???).
Please help me with this...
0
 
ZifNabCommented:
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);
begin
 Table1.Fields[4].index :=1
end;

RegardS, Zif.
0
 
roosiedbAuthor Commented:
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.
0
 
ZifNabCommented:
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.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now