Autor Beitrag
Master_BB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 90



BeitragVerfasst: Sa 08.05.04 11:39 
Hya,
ich hab ein Primzahl such programm geschrieben, jedoch bekomme ich immer bei
dem Gauge Prozentbalken einen fehler wenn meine anfangszahl von wo aus er suchen
soll größer 1 ist.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
 p   := StrToInt(Edit1.Text);
 bis := StrToInt(Edit2.Text);
 Gauge1.MinValue := von;
 Gauge1.MaxValue := bis;
 repeat
  i := 1;
  p := p+1;
  repeat
   i := i+1;
   if (p mod i) = 0 then break;
   if (i = p-1) and ((p mod i) <> 0) then
    begin
     ListBox1.Items.Add(IntToStr(p));
     anzahl := anzahl +1;
    end;
  until i = bis-1;
  Gauge1.Progress := p;
 until p = bis;


undzwar wenn p > 1 dann kommt der fehler bei Gauge1.MaxValue := bis;
dort sagt er die zahl muß zwischen -27000 und 99 oder so liegen.
wenn p = 1 dann klappt es mit der Prozentleiste.
Weiß einer was ich tun kann das er mir auch dann den Status ausgibt wie weit er ist?

Greetz
Master_BB
chefkoch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

WIN XP pro
D7
BeitragVerfasst: So 09.05.04 19:02 
Hallo!
Habs gerade mal getestet.

Das Problem (Zahl muss zwischen -297464613749641 und 99 liegen) tritt nur dann auf
wenn minvalue > maxvalue.

Check it out

Chefkoch

_________________
Chaos, Panic, Disorder - My work here is done
obbschtkuche
Gast
Erhaltene Danke: 1



BeitragVerfasst: So 09.05.04 20:46 
ausblenden Delphi-Quelltext
1:
2:
3:
p   := StrToInt(Edit1.Text);
 bis := StrToInt(Edit2.Text);
 Gauge1.MinValue := von;


Hast du von auch sicher initialisiert?
Master_BB Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 90



BeitragVerfasst: So 09.05.04 23:26 
chefkoch thx für die gute fehleranalyse.
glaub daran lags muß ich nachher nochmal richtig testen.

-

obbschtkuche
ja du hast recht die variable "von" ist noch rein relikt aus einer
frühreren bearbeitung. von ist nun p hab ich gerade geändert daran wirds
wohl gelegen haben. dadurch hat gauge keinen richtigen wert
zugewiesen bekommen und daher kam dan auhc der fehler

thx