Re: printing in delphi


[ DelphiLand Discussion Forum ]

Posted by webmaster Guido on August 27, 2002 at 03:19:51:

In Reply to: printing in delphi posted by Jimbo on August 14, 2002 at 02:46:52:

: How can I print a Char in code?

: I have found the ascii value of a number and need to print the result

: AscValue:= Chr(CharToCon);

-------------------------------

If you know the ASCII code of a character, you can get the corresponding character with the function Chr(). For example, Chr(97) returns 'a', Chr(98) returns 'b', and so on...

This code would make Label1 display an 'a':
Label1.Caption := Chr(97);

The reverse function of Chr() is Ord(). For example, Ord('a') returns 97, Ord('b') returns 98, and so on.

This code would make Label1 display '97':
Label1.Caption := IntToStr(Ord('a'));


[ DelphiLand Discussion Forum ]