Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 03-05-2001, 03:42 AM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default Select record in a table question

//If i use this code i wrote then it is scrolling
//from min to max records.
//It Scrolls but it can't select the records min to max
//How can this be done?
//
//When i place a DBGrid i can select a record manual but
//i want to do that automaticly and non visible.


Var Min, Max, i


Min := 0;
Max := Table1.RecordCount;
Table1.First;
//here comes the output

for i := Min to Max do
begin
Table1.Next;
Reply With Quote
  #2  
Old 03-05-2001, 06:41 AM
Claude Claude is offline
Senior Member
 
Join Date: Jan 2001
Posts: 178
Default RE: Select record in a table question

Sadly, TDbGrid.SelectedRows is ReadOnly. If this was not the case, yout loop would become

for i := Min to Max do begin
DbGrid1.SelectedRows.Items.Add(Table1.Bookmark);
Table1.Next;
end;

So, if you want to implement a 'Select All' method, you can either try to modify the source of TDbGrid (hard if you are unexperienced), you can use a TDbGrid replacement (I use DevExpress's Quantum Grid), or you can send keys to the TDbGrid like if a user was manually selecting it (Search the forum for more info about sending keys since people are often requesting about it).
Reply With Quote
  #3  
Old 03-05-2001, 08:20 AM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: If i use this it works almost but..

If i use this it works but it is Random.
How can i make it count as for i := 1 to 100 for example?

Table1.MoveBy(Random(Table1.Recordcount));
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 05:23 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.