Autor Beitrag
juergen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 87



BeitragVerfasst: Mi 14.07.04 15:09 
Hallo,

wie kann ich alle Zeilen in einem DBGrid selektieren ?
Durch "Knopfdruck" sollen alle Zeilen und Spalten selektiert sein.

DANKE

juergen
DelphiFreund
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 120

Win XP
D7 Enterprise
BeitragVerfasst: Mi 14.07.04 15:14 
Ich bin mir nicht sicher, aber gibt es nicht eine Einstellung wie 'MultiSelect' oder so?
juergen Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 87



BeitragVerfasst: Mi 14.07.04 15:20 
Den gibt es,
aber damit bestimmst du ja nur ob prinzipiell mehere Datensätze selektiert werden können.
DelphiFreund
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 120

Win XP
D7 Enterprise
BeitragVerfasst: Mi 14.07.04 15:32 
Tut mir leid, dann kann ich dir wohl nicht helfen :(
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Do 15.07.04 12:37 
HAllo,

da TDBGrid in ein TStringgrid gecastet werden kann, schau dir mal die Eigenschaft SelectionRange oder so ähnlich des Stringgrids an.

Gruß
Ken

_________________
Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Di 30.11.04 10:25 
Titel: hmm,
Auch wenn die Antwort relativ kommt, ich hatte dass selbe Problem und hab diese Lösung gefunden :


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure Tform.Select_All_Rows;
begin
  if query.Active then
  begin
    query.First;
    while not(query.Eof) do
    begin
      dbgrid.SelectedRows.CurrentRowSelected := TRUE;
      query.Next;
    end;
    Application.ProcessMessages;
  end;
end;


query ist eine TQuery Komponente DBGrid dei TDBGrid Komponente. Du muss alle rows durchlaufen. Zum Unselecten dasselbe nur TRUE durch FALSE ersetzen.

_________________
mfg. Joel
BPK
Hält's aus hier
Beiträge: 2



BeitragVerfasst: Do 19.05.05 10:12 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
function GridSelectAll(Grid:TDBGrid):LongInt;
begin
  Result:=0;
  Grid.SelectedRows.Clear;
  with Grid.DataSource.DataSet do begin
    First;
    DisableControls;
    try
      while not EOF do begin
        Grid.SelectedRows.CurrentRowSelected:=True;
        Inc(Result);
        Next;
      end;
    finally
      EnableControls;
    end;
  end;
end;