Toon posts:

[Delphi/pascal] Hulp

Pagina: 1
Acties:
  • 49 views sinds 30-01-2008

Verwijderd

Topicstarter
sorry voor de vage naam maar als een moderator een betere heeft verander hem dan maar.

Ik ben voor het eerst iets met delphi te doen en ik krijg een fout melding kan iemadn me helpen.

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Edit1: TLabeledEdit;
    Edit2: TLabeledEdit;
    BitBtn1: TBitBtn;
    StaticText1: TStaticText;
    StaticText2: TStaticText;
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.BitBtn1Click(Sender: TObject);
var E1, E2, L: integer;

begin
E1 := StrToInt (Edit1.text);
E2 := StrToInt (Edit2.text);
L := StrToInt (Label1.text);
if Edit1 <= 1
then label1.caption := IntToStr (edit2-3000)
else if Edit1 = 2
then label1.caption := inttostr (edit2-4500)
else if Edit1 = 3
then label1.Caption := inttostr (edit2-6500)
else if Edit1 >= 4
then label1.caption := inttostr (edit2-(edit1*2000))


end;

end.


dit is dus de code die ik heb.
code:
1
2
3
4
5
6
[Error] Unit1.pas(37): Undeclared identifier: 'text'
[Error] Unit1.pas(39): Incompatible types
[Error] Unit1.pas(39): Operator not applicable to this operand type
[Error] Unit1.pas(41): Incompatible types
[Error] Unit1.pas(41): Operator not applicable to this operand type
[Fatal Error] auto_P.dpr(5): Could not compile used unit 'Unit1.pas'


en dit zijn de meldingen

  • brokenp
  • Registratie: December 2001
  • Laatst online: 11:37
Wat begrijp je niet aan deze meldingen:
Bijvoorbeeld de 1e:
[Error] Unit1.pas(37): Undeclared identifier: 'text'

Je kijkt op regel 37 en ziet:
L := StrToInt (Label1.text);
Maar verderop staat label1.caption, juist ja, een label heeft geen text.

Ga zo al je fouten af en probeer het opnieuw...

  • KompjoeFriek
  • Registratie: Maart 2001
  • Laatst online: 02-01 05:18

KompjoeFriek

Statsidioot

ff simpele uitleg voor je foumeldingen:

[Error] Unit1.pas(37): Undeclared identifier: 'text'
een TLabel heeft geen attribuut "text" maar "caption"
(iets naar onder doe je het wel goed)

[Error] Unit1.pas(39): Incompatible types
een TLabeledEdit is niet compatible met een Integer

[Error] Unit1.pas(39): Operator not applicable to this operand type
weer een fout dat je een TLabeledEdit direct aanroep ipv een attribuut ervan

[Error] Unit1.pas(41): Incompatible types
een TLabeledEdit is niet compatible met een Integer

[Error] Unit1.pas(41): Operator not applicable to this operand type
weer een fout dat je een TLabeledEdit direct aanroep ipv een attribuut ervan

[Fatal Error] auto_P.dpr(5): Could not compile used unit 'Unit1.pas'
preekt voor zich ;)

Eigenlijk is het op GoT niet de bedoeling hier zomaar een stuk code neer te kwakken en hopen dat iemand het voor je debugt, maar dat je eerst zelf op onderzoek uit gaat, tutorials volgt, FAQ's leest, enz.

veel succes iig :)

[ Voor 13% gewijzigd door KompjoeFriek op 27-09-2004 23:11 . Reden: typo's er snel uitgehaald :) ]

WhatPulse! - Rosetta@Home - Docking@Home


Verwijderd

Topicstarter
dankje dankje, net als bij het css geval dit is mijn eerste projectje voor school enzo dus weer is alle hulp welkom, ik denk dat het zo wel lukt. :)

  • Janoz
  • Registratie: Oktober 2000
  • Laatst online: 11:49

Janoz

Moderator Devschuur®

!litemod

Prettig dat je probleem in ieder geval opgelost is, maar ga er in het vervolg maar van uit dat topics met compile fouten gewoon dicht gaan. Zoals ook in de faq staat zijn compile fouten redelijk simpel zelf op te lossen met een naslag werk erbij. Daarnaast is je titel ook niet je van het.

Ken Thompson's famous line from V6 UNIX is equaly applicable to this post:
'You are not expected to understand this'


Dit topic is gesloten.