Einzelnen Beitrag anzeigen

xan553

Registriert seit: 29. Jan 2007
32 Beiträge
 
#1

bessere lösung für prozeduren

  Alt 28. Okt 2011, 22:36
servus,

gibt es für solche codepassagen vielleicht bessere lösungen die nicht so massig sind?

Delphi-Quellcode:
procedure TTblLieferanten.setSearchLabels(m: Byte);
begin
  case m of
    1: begin
         combobox2.Clear;
         Label10.visible := True;Label10.Caption := '1 = Name';
         Label11.visible := True;Label11.Caption := '2 = Kunden Nr.';
         Label13.visible := True;Label13.Caption := '';
         Label14.visible := True;Label14.Caption := '';
         combobox2.Items.Add('1');
         combobox2.Items.Add('2');
         combobox2.ItemIndex := 0;
       end;
    2: begin
         combobox2.Clear;
         Label10.visible := True;Label10.Caption := '1 = Name';
         Label11.visible := True;Label11.Caption := '3 = Artikel Nr.';
         Label13.visible := True;Label13.Caption := '6 = Bezeichnung';
         Label14.visible := True;Label14.Caption := '7 = Lieferanten';
         combobox2.Items.Add('1');
         combobox2.Items.Add('3');
         combobox2.Items.Add('6');
         combobox2.Items.Add('7');
         combobox2.ItemIndex := 0;
       end;
    3: begin
         combobox2.Clear;
         Label10.visible := True;Label10.Caption := '2 = Kunden Nr.';
         Label11.visible := True; Label11.Caption := '5 = Rechnungs Nr.';
         Label13.visible := True; Label13.Caption := '';
         Label14.Caption := '';
         combobox2.Items.Add('1');
         combobox2.Items.Add('2');
         combobox2.Items.Add('5');
         combobox2.ItemIndex := 0;
       end;
    4: begin
         combobox2.Clear;
         Label10.visible := True;Label10.Caption := '1 = Name';
         Label11.visible := True;Label11.Caption := '2 = Kunden Nr.';
         Label13.visible := True;Label13.Caption := '4 = Auftrags Nr.';
         Label14.Caption := '';
         combobox2.Items.Add('1');
         combobox2.Items.Add('2');
         combobox2.Items.Add('4');
         combobox2.ItemIndex := 0;
       end;
    5: begin
         combobox2.Clear;
         Label10.visible := True;Label10.Caption := '1 = Name';
         Label11.Caption := '';
         Label13.Caption := '';
         Label14.Caption := '';
         combobox2.Items.Add('1');
         combobox2.ItemIndex := 0;
       end;
end;
  Mit Zitat antworten Zitat