Autor Beitrag
peicher
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16

Windows XP, Windows 2K, Suse Linux 8.2
Borland Delphi 7
BeitragVerfasst: Fr 12.09.03 13:18 
Hallo!
Kann ich mit einer case-anweisung auch auf Strings überprüfen? Wenn ja, wie?
Hab folgenden code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
  case SearchCombo.Items.Text of
  'Vorname':  begin
                while DataSet.Eof = false do
                begin
                  if strcomp(PChar(SearchString), PChar(AdressTabelle.Items[counter].SubItems[0])) = 0 then
                  begin
                    DataSet.MoveBy(counter);
                  end;
                  else

                  begin
                    counter := counter +1;
                  end;
                end;
              end;
  'Nachname': begin
              end;
  'Strasse':  begin
              end;
  'PLZ':      begin
              end;
  'Ort':      begin
              end
  end;


Würd mich freuen, wenn mir jemand wieterhelfen könnte! :wink:

_________________
-PHIL-
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Fr 12.09.03 14:02 
Hi,

das geht nicht. Case-Anweisungen funktionieren nur mit Ordinalen-Typen. Aber in deinem Fall könntest du ja auch mit dem Index der Items der ComboBox arbeiten:


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
  case SearchCombo.ItemsIndex of 
  0:  begin 
                while DataSet.Eof = false do 
                begin 
                  if strcomp(PChar(SearchString), PChar(AdressTabelle.Items[counter].SubItems[0])) = 0 then 
                  begin 
                    DataSet.MoveBy(counter); 
                  end; 
                  else 

                  begin 
                    counter := counter +1; 
                  end; 
                end; 
              end; 
  1: begin 
              end; 
  2:  begin 
              end; 
  3:      begin 
              end; 
  4:      begin 
              end 
  end;


MFG

- Ernesto -
peicher Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16

Windows XP, Windows 2K, Suse Linux 8.2
Borland Delphi 7
BeitragVerfasst: Fr 12.09.03 14:12 
ok.

trotzdem danke für die antwort!

mfg

_________________
-PHIL-