Autor Beitrag
detke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55

WIN XP
Delphi 5
BeitragVerfasst: Mo 22.05.06 11:42 
Hi,

Kann ich ein wenn ich in ein Edit etwas eingabe das dass dann statt Buchstaben *** für jeden Buchstaben kommt?
Geht das?

Gruss Detlef
Hack Gott
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 409

Windows Vista
Delphi 2005 Personal, Delphi 7
BeitragVerfasst: Mo 22.05.06 11:50 
user profile icondetke hat folgendes geschrieben:
Hi,

Kann ich ein wenn ich in ein Edit etwas eingabe das dass dann statt Buchstaben *** für jeden Buchstaben kommt?
Geht das?

Gruss Detlef


edit1.passwordchar := '*';
detke Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55

WIN XP
Delphi 5
BeitragVerfasst: Mo 22.05.06 11:53 
Danke.

so Passwort abfrage funkt jetzt aber wie kann ich wenn das Falsche Passwort eigegeben wird ein Fehlermeldung bekommen?

Gruss Detlef
Chughallen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 21



BeitragVerfasst: Mo 22.05.06 11:58 
Hallo.

Du mußt das Paßwort vergleichen und dann selbst entscheiden, was dann passieren soll.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
if password <> password_entered then
begin
//Fehlermeldung hier oder was auch immer du vor hast
end;



Du mußt schon selber entscheiden, was passiert, wenn das passwort falsch ist.
Du könntest eine MessageBox öffnen, du könntest dem User böse Dinge sagen, wie unfähig er ist oder was immer du willst.
detke Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55

WIN XP
Delphi 5
BeitragVerfasst: Mo 22.05.06 12:05 
Wo muss den das rein?
Hack Gott
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 409

Windows Vista
Delphi 2005 Personal, Delphi 7
BeitragVerfasst: Mo 22.05.06 12:07 
beispielsweise nimmst du einen Button jetzt fügst du bei dem OnClick ereigniss das hier ein:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
if edit1.text = 'dein passwort' then begin
//PW ist richtig, was er dann tun soll
end else begin
//PW ist falsch, was er dann tun soll
end;


Und des was ich oben geschrieben habe fügst du beim OnCreate deiner Form ein
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mo 22.05.06 12:07 
ins Buttonclick ereignis
z.b:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
 procedure buttonloginclick (Sender);
begin
if passwort<>eingegebenes_passwort then
  showmessage('das passwort ist falsch')
else form2.show;
end;

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
detke Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55

WIN XP
Delphi 5
BeitragVerfasst: Mo 22.05.06 12:15 
Er meldet mir immer :

if passwort<>eingegebenes_passwort then wäre Falsch.

Mein Code:

ausblenden volle Höhe 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:
39:
40:
41:
42:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button2Click(Sender: TObject);
begin
Close;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
if passwort<>eingegebenes_passwort then
  showmessage('das passwort ist falsch')
else form2.show;
end;

end.


Hoffentlich findet ihr was.

Und wo steht dann mein Passwort?

Gruss Detlef
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Mo 22.05.06 12:17 
passwort sollst du durch eine String-Variable ersetzen, die dein Passwort als Inhalt hat. und eingegebenes_passwort musst du durch Edit1.Text ersetzen.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
King_Crasher
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37

WIN XP
Delphi 2003
BeitragVerfasst: Mo 22.05.06 12:39 
Hallo es geht auch ohne Variablen und zwar so:



If edit1.text<>'Passwort' then //Edit1 is dat Feld wo das Passwort steht. Passwort könnte zum Beispiel Test sein
begin
showmessage('Falsches Passwort.');
edit1.setfocus;
end;
detke Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55

WIN XP
Delphi 5
BeitragVerfasst: Mo 22.05.06 12:58 
Hi,

Hat schon geklappt.

Gruss Detlef

Ps.: habe mal die Exe angehängt. Passwort ist ' test ' .
Einloggen, um Attachments anzusehen!