Forum Home
Press F1
 
Thread ID: 52509 2004-12-21 02:34:00 [B]Delphi Step-By-Step Help[/B] ProMaz (34) Press F1
Post ID Timestamp Content User
306158 2004-12-21 02:34:00 Hey, I have some time to kill before xmas so i thought I'ld read the articles on using Delphi. I downloaded Delphi version 7 (even though the tutorial is for version 5) and am follow step 1 and I am already stuck.

I says add a lable to the whole screen (done easy). Now add a button and put the following command:

Double-click on your Hello button and enter Label1.Caption := ‘Hello PC World!’; (Don’t forget that semicolon!) You can probably guess what this does. Whenever the Hello button is clicked, label1’s caption — which you’ve cleared — will be set to the message.

I followed this exactly but i get the follow error message when I try to run the program:

[Error] Unit1.pas(37): Illegal character in input file: '‘' ($91)
[Error] Unit1.pas(37): Illegal character in input file: '!' ($21)
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'

Is this because it's a differance version of Delphi or am I doing somthing completely stupid lol

Thanks

James :thumbs:
ProMaz (34)
306159 2004-12-21 02:43:00 *Bump* ProMaz (34)
306160 2004-12-21 03:08:00 It doesn't seem to like the opening quote (') on the string. In the error messages it displays as a "proper" left quote. Did you use the simple single quote (on the "/' key just to the left of the <enter> key) or did you manage to insert the fancy left and right quotes?

Pascal would cough on the fancy quotes,so I'd assume Delphi would.

That's the most likely cause that I can think of. Mostly, compilers like only characters which are on the keytops, unless they are in strings (which are just data and are not compiled). Some compilers I have used insisted on upper case only,and others which insisted on lowercase only.:D
Graham L (2)
306161 2004-12-21 03:53:00 I have no idea what you are on about lol. All i know is that i copied and pasted exactly what was on the web site (the command that is). ProMaz (34)
306162 2004-12-21 03:57:00 Ok, i got past it now. Seems that Delphi 7 likes only << ' >> those charactars and not the << ‘ ’ >> that lean right and left. Can move on now :D ProMaz (34)
306163 2004-12-21 03:59:00 Tried your code on Delphi 6. Works fine for me, here's the code in full:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption:='Hello PC World!';
end;

end.
pine-o-cleen (2955)
306164 2004-12-21 04:10:00 A string is a series of characters which can be "printed" or used in various other ways by a programme.

So the compiler can tell a string apart from other characters which it will use to build a programme, a string is put inside delimiters. In Pascal, and Delphi, the string delimiter is the "single quote", ('). Just to be different I used the double quote (") for the string single quote.

In your example, the string Hello P C World! is surrounded by different quote characters. Look carefully. They look like commas (one reversed). If you cut and pasted those lines into Delphi, that would explain it. Replace those quotes qith the correct one.

You must use the correct punctuation (and spelling) in programming.To compile and run a programme correctly it must be exactly correct. ;)
Graham L (2)
1