Autor Beitrag
JungerIslaender
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 427
Erhaltene Danke: 5

Win XP
Delphi 7; Delphi 2005
BeitragVerfasst: Mi 12.12.07 14:01 
Könnt mir mal jemand sagen was exceptions sind oder einen link geben habe selbst nichts gefunden. Und bräuchte dringend hilfe: in meinem Programm treten Fehler auf und ich habe keine ahnung warum.
Aber nur wenn ich auf encode drücke nicht aber wenn ich beide mal auf change klicke.
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:
procedure Tform1.change;
var i: integer; a:word;
begin
memo2.text:='';
SetLength(myIntArray, Length(Memo1.Text));
for i:= 0 to (Length(Memo1.Text)+1do
  begin
  myIntarray[i]:=Ord(Memo1.Text[i]);
  Memo2.Lines.Add(IntTOStr(myIntarray[i]+code));
  end;
for a:= Memo2.Lines.Count-1 downto 0 do
  begin if Memo2.Lines[a] = inttostr(code) then Memo2.Lines.Delete(a); end;
end;


procedure Tform1.encode;
var i: integer;
begin
memo3.Text:='';
for i := 0 to Memo2.Lines.Count-1 do
Memo3.Text := Memo3.Text + Chr(strtoint(Memo2.Lines[i]));

end;



Moderiert von user profile iconNarses: Topic aus VCL (Visual Component Library) verschoben am Mi 12.12.2007 um 14:41
Einloggen, um Attachments anzusehen!
Xion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: Mi 12.12.07 18:06 
user profile iconJungerIslaender hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
for i:= 0 to (Length(Memo1.Text)+1do					

böser Fehler :lol:

a) wenn schon, dann -1
b) bei text gehts von 1 bis Length(Text)

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
DrRzf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 260

Win XP Prof
D7 Enterprise
BeitragVerfasst: Mi 12.12.07 19:56 
Irgendwie stimmt da was nicht.
da verabschiedet sich gleich der debugger wegen zu vieler auftrtender fehler :omg:

Edit:
der grosse absturz passiert auch wenn du das zweitemal auf den ersten button klickst.
Einloggen, um Attachments anzusehen!
_________________
rein statistisch gesehen darf man keiner statistik trauen die man nicht selbst gefälscht hat.
Zorro
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win 2000, Win XP Pro
Delphi 7 Architect
BeitragVerfasst: Do 13.12.07 00:57 
Du greifst unerlaubt auf Speicherbereiche zu.

Greetz
Zorro
JungerIslaender Threadstarter
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 427
Erhaltene Danke: 5

Win XP
Delphi 7; Delphi 2005
BeitragVerfasst: Do 13.12.07 20:50 
Bei -1 ändert sich auch nix. Was sind jetzt exceptions?
HILFE HILFE warum hilft mir keiner? Was soll ich jetzt machen?

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:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
procedure Tform1.change;
var i,j: integer; a:word;
begin
memo2.text:='';
SetLength(myIntArray, Length(Memo1.Text));
for i:= 0 to (Length(Memo1.Text)+1do
  begin
  myIntarray[i]:=Ord(Memo1.Text[i]);
  j:=myintarray[i];
  z:=myintarray[i];
    case radiogroup1.ItemIndex of
     (1) : begin if j+code > (122then
            begin j:=((j+code)-122)+96; myIntarray[i]:=j;
            Memo2.Lines.Add(IntTOStr(myIntarray[i]));
            end else begin myIntarray[i]:=j;
                     Memo2.Lines.Add(IntTOStr(myIntarray[i]+code));
                     end;
           end;
     else  begin myIntarray[i]:=j;
           Memo2.Lines.Add(IntTOStr(myIntarray[i]+code));
           end;
    end;
  end;
for a:= Memo2.Lines.Count-1 downto 0 do
  begin if Memo2.Lines[a] = inttostr(code) then Memo2.Lines.Delete(a); end;
end;


procedure Tform1.encode;
var i: integer;
begin
memo3.Text:='';
for i := 0 to Memo2.Lines.Count-1 do
Memo3.Text := Memo3.Text + Chr(strtoint(Memo2.Lines[i]));
end;


procedure TForm1.decode;
var b,i:integer; a:word;
begin
memo1.text:='';
memo2.text:='';
SetLength(myIntArray1, Length(Memo3.Text));
for i:= 0 to (Length(Memo3.Text)+1do
  begin
  myIntarray1[i]:=Ord(Memo3.Text[i]);
  b:=myintarray1[i];
  z:=myintarray[i];
    case radiogroup1.ItemIndex of
     (1) : begin if b+code > (122then
            begin b:=((b+code)-122)+96; myIntarray1[i]:=b;
            Memo2.Lines.Add(IntTOStr(myIntarray1[i]));
            end else begin myIntarray1[i]:=b;
                     Memo2.Lines.Add(IntTOStr(myIntarray1[i]+code));
                     end;
           end;
     else  begin myIntarray1[i]:=b;
           Memo2.Lines.Add(IntTOStr(myIntarray1[i]+code));
           end;
    end;
  end;
for a:= Memo2.Lines.Count-1 downto 0 do
  begin if Memo2.Lines[a] = inttostr(code) then Memo2.Lines.Delete(a);
  end;
for i := 0 to Memo2.Lines.Count-1 do
  begin
  Memo1.Text := Memo1.Text + Chr(strtoint(Memo2.Lines[i]));
  end;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
change;
encode;
end;


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


procedure TForm1.Button3Click(Sender: TObject);
begin
decode;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
encode;
end;


procedure TForm1.Timer1Timer(Sender: TObject);
var a,i:integer;
begin
  case radiogroup1.ItemIndex of
    (0):  begin code:=0; combobox1.Enabled:= false;
                spinedit1.Enabled:= False; end;
    (1):  begin code:= strtoint(combobox1.Text); combobox1.Enabled:= True;
                spinedit1.Enabled:= False; end;
    (2):  begin If Not TryStrToInt (Spinedit1.text, Code)
                Then begin code:=0; label1.visible:=true end else Label1.visible:= False;
                 combobox1.Enabled:= False; spinedit1.Enabled:= True;
                 if z-code <= 0 then code:=0;
                     end;
  end;
Einloggen, um Attachments anzusehen!
DrRzf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 260

Win XP Prof
D7 Enterprise
BeitragVerfasst: Do 13.12.07 20:54 
exception = Fehler

das kann alle möglichen ursachen haben.
Stell mal deinen source komplett rein. (die exe braucht nicht dabei sein) dann seh ich mir das mal an.
Die exe allein ist für fehlersuche recht wenig aufschlussreich.

und mach mal in den zeilen 6 + 46 aus dem + ein -

ausblenden Delphi-Quelltext
1:
for i:= 0 to (Length(Memo3.Text)-1do					

_________________
rein statistisch gesehen darf man keiner statistik trauen die man nicht selbst gefälscht hat.
JungerIslaender Threadstarter
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 427
Erhaltene Danke: 5

Win XP
Delphi 7; Delphi 2005
BeitragVerfasst: Do 13.12.07 21:16 
wenn ich minus ein schreibe verschluckt er immer den letzten eingegeben buchstaben und die fehler kommen trotzdem.
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 13.12.07 21:17 
Memo.Text ist ein String und geht deshalb von 1 bis length(xyz). :wink:

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.


Zuletzt bearbeitet von jakobwenzel am Fr 14.12.07 13:11, insgesamt 1-mal bearbeitet
DrRzf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 260

Win XP Prof
D7 Enterprise
BeitragVerfasst: Do 13.12.07 21:26 
user profile iconjakobwenzel hat folgendes geschrieben:
Memo.Text ist ein String und geht deshalb von 12 bis length(xyz). :wink:


Ist ja nen Text, da haste natürlich recht, auch wenn du ne 2 zuviel hast :-)

sollte dann dementsprechend so aussehen


ausblenden Delphi-Quelltext
1:
for i:= 1 to (Length(Memo3.Text)) do					


MyIntArray scheint ja dynamisch zu sein, und beginnt daher bei 0.
darum müsste es dann 2 zeilen später so lauten

ausblenden Delphi-Quelltext
1:
myIntarray[i -1 ]:=Ord(Memo1.Text[i]);					


das nächste. währe es möglich dass dir evtl auch der timer an ner variablen rummschraubt, während er in einer annderen procedure grad verwendet wird ?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.Timer1Timer(Sender: TObject);  
var a,i:integer;  
begin  
  case radiogroup1.ItemIndex of  
    (0):  begin code:=0; combobox1.Enabled:= false;  
                spinedit1.Enabled:= False; end;  
    (1):  begin code:= strtoint(combobox1.Text); combobox1.Enabled:= True;  
                spinedit1.Enabled:= False; end;  
    (2):  begin If Not TryStrToInt (Spinedit1.text, Code)  
                Then begin code:=0; label1.visible:=true end else Label1.visible:= False;  
                 combobox1.Enabled:= False; spinedit1.Enabled:= True;  
                 if z-code <= 0 then code:=0;  
                     end;  
  end;


kannst du diese änderungen nicht durch die beteiligten compos realisieren ?
zb diese procedure in das onchange der radiogrup schreiben, und die restlichen elementa auf diese procedure dann verweisen ?

_________________
rein statistisch gesehen darf man keiner statistik trauen die man nicht selbst gefälscht hat.