Autor Beitrag
xilos
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59



BeitragVerfasst: Do 28.09.06 15:44 
hallo also ich habe bis jetzt das hier ^^

ausblenden volle Höhe 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:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var kennwort:string;
var kennwort2:string;
begin
  kennwort:='hallo';
  kennwort2:='geheim';
  if edit1.Text=kennwort   then edit1.text:='Hallo Herr Bruce W.';
  if edit1.Text=kennwort2  then edit1.text:='Hallo Frau Marlene W.'
                           else edit1.Text :='falsch';
end;

end.


und zwar soll ich das so machen...
wenn ich in das feld das "kennwort" eingebe soll "hallo herr bruce w" im editfeld erscheinen
wenn ich in das editfeld "kennwort2" eingebe soll "hallo frau marlene w." im editfeld erscheinen.
im mom zeigt er mir aber immer n wenn ich "kennwort" eingebe, dass es falsch ist...bei "kennwort2" ist alles richtig und funktioniert auch.
thx jetzt schon mal
Miri
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 657


Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Do 28.09.06 15:49 
nein, er ist nur schneller als du...
ganz einfach: erstes if: "passt" und schreibt den ersten text rein, dann zweites if, "passt nicht", aber da gibts ja noch ein else... also da rein und das reinschreiben...

so funktioniert es:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
  kennwort:='hallo';
  kennwort2:='geheim';
  if edit1.Text=kennwort   then edit1.text:='Hallo Herr Bruce W.'
  else 
    if edit1.Text=kennwort2  then edit1.text:='Hallo Frau Marlene W.'
      else edit1.Text :='falsch';

_________________
Anonymes Eckenkind
xilos Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59



BeitragVerfasst: Do 28.09.06 15:53 
okay thx funktionert