Autor Beitrag
hibbert
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Mo 15.07.02 18:52 
hallo,
ich hab mal ne kleene frage:
ich möchte gerne ein memofeld nacheiner bestimmten zahl suchen,und diese makiert haben. diezu suchende zahl soll vorher in ein edit feld eingegeben werden.
kann mir jemand helfen??
jetzt schonmal vielen Dank !

mfg hibbert

Link entfernt. Tino
DBR
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 46



BeitragVerfasst: Mo 15.07.02 20:10 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
var dummy:double;
p:integer;
begin
if key=#13 then begin
key:=#0;
try
dummy:=strtofloat(edit1.text);
except
showmessage('Edit1 enthält keine gültige Zahl');
exit;
end;
p:=pos(edit1.text,memo1.text);
if p=0 then begin
showmessage('Nichts gefunden');
exit;
end;
memo1.selstart:=p-1;
memo1.sellength:=length(edit1.text);
memo1.setfocus;
end;
end;

gruss DBR
hibbert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Mo 15.07.02 20:18 
Titel: danke
danke für den quellcode!
aber in der ertsen zeile des quellcodes zeigt mird elphi ein fehler an. woran liegt das ?
mfg philipp
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Mo 15.07.02 21:13 
Was für einen Fehler zeigt Dir der Compiler denn an?
DBR
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 46



BeitragVerfasst: Mo 15.07.02 23:03 
Bist du sicher, dass du den Code in "KeyPress" eingesetzt hast?
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 15.07.02 23:53 
Hast Du das KeyPress auch in der Private-Sektion des Forms definiert? Also so:
ausblenden Quelltext
1:
2:
private
  procedure Edit1KeyPress(Sender: TObject; var Key: Char);

Gruß
hibbert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Di 23.07.02 21:12 
Es funzt !
DANKE! :D