jfgrayiii
asked on
Setting up a button to Control a data grid
I am trying to creat a button that on click event will be to move to records beging with certian letters in the Data Grid
Example
2 Fields
Artist
Title
When you push the Button with the label A it will move the grid to all the A;s in the data grid
The data base is access using ADO connection string
Example
2 Fields
Artist
Title
When you push the Button with the label A it will move the grid to all the A;s in the data grid
The data base is access using ADO connection string
ASKER
Is caption where I will put the value I want filtered
example show me only Filed named Artist that starts with 'A'
example show me only Filed named Artist that starts with 'A'
here's a quick example i wrote for you
put 2 buttons on the form
set button 1's caption to 'A'
set button 2's caption to 'B'
use the same OnClick event for each button and do this
procedure TForm1.AtoZButtonClick(Sen der: TObject);
var
s: string;
begin
s := (Sender as TButton).Caption;
Table1.FindNearest([S]);
end;
put 2 buttons on the form
set button 1's caption to 'A'
set button 2's caption to 'B'
use the same OnClick event for each button and do this
procedure TForm1.AtoZButtonClick(Sen
var
s: string;
begin
s := (Sender as TButton).Caption;
Table1.FindNearest([S]);
end;
hmm, as far as i know findnearest requires an index
>Is caption where I will put the value I want filtered
yes, this caption was meant of the botton, as in TheRealLoki sample
meikl ;-)
>Is caption where I will put the value I want filtered
yes, this caption was meant of the botton, as in TheRealLoki sample
meikl ;-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
yes -> use the locate-method of the dataset
buttonclickevent
dataset.locate(fieldname,T
no -> use the filterproperty of the dataset
buttonclickevent
dataset.filter('fieldname like '+quotedstr(TButton(sender
dataset.filtered := true;
just from head, means not tested and typos possible
meikl ;-)