Autor Beitrag
Biarchiv
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: So 03.08.03 19:19 
Hallo,

Brauche da eine simplen Aufbau einer Serieneingabe mit Namen (Edit1.Text) und Firma (Edit2.Text) überprüfung. Eingabe der Seriennummer oder Buchstaben bei Edit3.Text. Also Er soll überprüfen ob Edit1.Text und Edit2.Text mit Edit3.Text Serial zusammenpasst.

Irrgenwas simples.
ausblenden Delphi-Quelltext
1:
2:
If (Edit2.Text[3] = [Edit2.Text[7]) then string := 'true';
If string = 'false' then showmessage('Falscher Code');

Danke...
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Mo 04.08.03 14:02 
Was willst du hören?

Soll ich dir jetzt sagen, wie du deine Seriennummern aufbauen sollst?

Ich glaube dass must du selbst wissen, aber hier sind ein paar Möglichkeiten:
- Quersummen
- Buchstabe = Zahl

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
Biarchiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: Mo 04.08.03 19:25 
Hallo derDoc,

Danke für Dein Posting.
Nur was sinples ZB.

Nimm von Edit3.Text das 3 Zeichen und vergleiche es mit Edit2.Text mit 5ten Zeichen
ob gleich.

Also nur so ein kleines Beispiel.

ThX
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Di 05.08.03 08:37 
Das hier wäre z.B. eine ganz einfache Überprüfung:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var
  echt: Boolean;
begin
  if (Edit1.Text[4] = Edit3.Text[7]) and (Edit2.Text[6] = Edit3.Text[2]) then
    echt := true
  else
    echt := false;

  if not echt then
    ShowMessage('Die Seriennummer ist falsch.');
end;


Zum Ermitteln ob echt oder falsch würde ich keinen String nehmen, sondern eine Variable vom Typ Boolean.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
recall
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 449



BeitragVerfasst: Mo 11.08.03 01:10 
Wenn du nur numerische Serials verwenden willst, hab ich was einfaches fertiges:
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:
43:
44:
45:
46:
47:
48:
49:
50:
51:
procedure TForm1.Starte_UeberpruefungClick(Sender: TObject);
var
  a, b, I: Integer;
  c: Double;
  Echt: Boolean;
begin
  Echt := True;
  a := 0;
  For I := 1 to Length(Edit1.Text) do
    a := a + Ord(Edit1.Text[I]);
  b := 0;
  For I := 1 to Length(Edit2.Text) do
    b := b + Ord(Edit2.Text[I]);
  c := a*b;
  For I := 1 to Round((Length(Edit1.Text) + Length(Edit2.Text))/2) do
    if Length(Edit3.Text)>=I then
    begin
      c := c*pi*I*I;
      Repeat
        c := c/10;
      Until c<11;
      if c>=10 then c := 0;
      if Edit3.Text[I]<>IntToStr(Round(c)) then
        Echt := False;
    end;
  if not Echt then MessageDlg('FALSCH !', mtError, [mbOK], 0);
end;

procedure TForm1.Lese_Serial_ausClick(Sender: TObject);
var
  a, b, I: Integer;
  c: Double;
begin
  Edit3.Clear;
  a := 0;
  For I := 1 to Length(Edit1.Text) do
    a := a + Ord(Edit1.Text[I]);
  b := 0;
  For I := 1 to Length(Edit2.Text) do
    b := b + Ord(Edit2.Text[I]);
  c := a*b;
  For I := 1 to Round((Length(Edit1.Text) + Length(Edit2.Text))/2) do
  begin
    c := c*pi*I*I;
    Repeat
      c := c/10;
    Until c<11;
    if c>=10 then c := 0;
    Edit3.Text := Edit3.Text + IntToStr(Round(c));
  end;
end;


Du brauchst dazu natürlich Edit1, Edit2, Edit3 und 2 Buttons... !
1 zum überprüfen und 1 um dir die Serials generieren zu lassen !

Viele Grüsse.
recall
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 449



BeitragVerfasst: Mo 11.08.03 01:12 
hmmm...

das hab ich eben zusammengeschrieben, es funzt auch.
Nur das jeder serial zu jeder Kombination von Edit1 und Edit2 eindeutig ist, das möchte ich nicht garantieren :)

Aber ist ja auch egal...

Viele Grüsse.