text========"everyone delphi fans"

i need help on delphi how to count the number of character enter by a user for exmaple if a user enters 2 in editbox1 and enters 5 in editbox2 then the program should display this using the above text in a memo.

"very"

meaning that the number specify in text 1 is is the beginning and the number specify in text 2 marks the ending.

please guys am new here help meeeeeeeeeeeeeeeeeeeeeeee

Recommended Answers

All 6 Replies

...

Hook keyboard keypress event, increase a counter everytime a key is pressed, I think that would do the trick

Thanks

I guess you havent checked the length of the entered text?

text========"everyone delphi fans"

i need help on delphi how to count the number of character enter by a user for exmaple if a user enters 2 in editbox1 and enters 5 in editbox2 then the program should display this using the above text in a memo.

"very"

meaning that the number specify in text 1 is is the beginning and the number specify in text 2 marks the ending.

please guys am new here help meeeeeeeeeeeeeeeeeeeeeeee

ok - add an OnChange event - and make both text boxes point to this event handler

const
stSOURCE :string = "everyone delphi fans";

Procedure Text1OnChange(sender)
var inStart, inEnd :integer;
stOutput:string;
begin
inStart:= StrToInt(text1.text);
inEnd:= StrToInt(text2.text);
//should check values here....ie must be numbers, etc
stOutput:=copy(stSource, inStart,inEnd);
//put output somewhere
label1.caption:=stOutput;
end;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.