[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

DBgrid columns

Posted on 2001-08-31
4
Medium Priority
?
288 Views
Last Modified: 2010-04-06
Hi,

i got an mdb access file, and i'm linking to it using a Tdatasource wich is connected to a TadoQuerry
and the dbgrid is connected to the Tdatasource

so i get my *wanted info* based on a querry and this is displayed in the dbgrid.

The columns are automaticly put in some order and the widths are also done automaticly, how can i do this manually io defining them in design time so they are for example all 50 pixels wide ?

i tried serveral things :
adding some columns using columns editor  but then my info wasn't displayed anymore

activating the querry in design time and modifying the width but then i couldn't change all of the columns (those strings defined in the access file 255 chars)
and also when i ran the program it was all reset.

so my question is how can i predefine these column widths and the order they appear in etc

thanks

0
Comment
Question by:joyrider
[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
  • 2
4 Comments
 
LVL 1

Expert Comment

by:ntony
ID: 6444434
try using TClientDataset


you can use EmptyDataSet,FieldDefs,CreateDataset to create the Dataset.
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6444512
This code will change all the colums in dbgrid to 50 width

procedure TForm1.Button1Click(Sender: TObject);
var
  I : integer;
begin
  for I := 0 to DBGrid1.Columns.Count -1 do
    DBGrid1.Columns[I].Width := 50;
end;
0
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 100 total points
ID: 6444873
and about the fileds order
you can change it from the sql statment
don't 'use select *',
use the field names
'select field1, field3, field2 from table'
0
 

Author Comment

by:joyrider
ID: 6445405
Ok thanks changing at runtime & order is done in sql code :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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 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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

656 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