Autor Beitrag
maniac_89
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 54



BeitragVerfasst: Sa 05.02.05 12:04 
Hi,
ich mal eine ganze doofe Frage :oops: , aber ich eben noch Anfänger. Und hier meine Frage: Warum gibt mir Delphi bei dieser Funktion ein Fehlermeldung aus, hier der Quelltext:

ausblenden volle Höhe Delphi-Quelltext
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:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

function einlesen (zahl1: integer): integer;
begin
 zahl1 := strtoint (edit1.text);
end;

end.


Moderiert von user profile iconGausi: Delphi-Tags hinzugefügt.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Sa 05.02.05 12:14 
Hallo und :welcome:

Was für eine Fehlermeldung kommt denn?

Folgendes fällt mir auf:
1.) Die procedur Button1Click(Sender: TObject) ist zwar deklariert, aber nicht implementiert. D.h. irgendwo unten muss noch stehen, was in der procedur passieren soll.

2.) Diese Funktion gehört nicht zu Form1, d.h sie kennt das Edit1 gar nicht.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
function einlesen (zahl1: integer): integer;   
begin   
 zahl1 := strtoint (edit1.text);   
end;

Also entweder
ausblenden Delphi-Quelltext
1:
2:
3:
4:
function TForm1.einlesen (zahl1: integer): integer;   
begin   
 zahl1 := strtoint (edit1.text);   
end;
oder
ausblenden Delphi-Quelltext
1:
2:
3:
4:
function einlesen (zahl1: integer): integer;   
begin   
 zahl1 := strtoint (Form1.edit1.text);   
end;

_________________
We are, we were and will not be.
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Sa 05.02.05 12:16 
Hallo

Zitat:

Und hier meine Frage: Warum gibt mir Delphi bei dieser Funktion ein Fehlermeldung aus,

Du möchtest uns nicht zufällig auch veraten, welche das ist?
so wie es da sthet kann man nur raten, bei dir fehlt der Bezug zur Form1

ausblenden Delphi-Quelltext
1:
2:
3:
4:
function einlesen (zahl1: integer): integer;  
begin  
 zahl1 := strtoint (Form1.edit1.text);  
end;

oder
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
type  
  TForm1 = class(TForm)  
    Button1: TButton;  
    Label1: TLabel;  
    Label2: TLabel;  
    Edit1: TEdit;  
    Edit2: TEdit;  
    procedure Button1Click(Sender: TObject);  
  private  
    { Private-Deklarationen }  
    function einlesen (zahl1: integer): integer; 
  public  
    { Public-Deklarationen }  
  end;  

function TForm1.einlesen (zahl1: integer): integer;  
begin  
 zahl1 := strtoint (edit1.text);  
end;


Mfg Frank

edit: zu langsam :)

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Sa 05.02.05 12:36 
wobei der sinn der funktion dann immer noch net ganz klar ist ;>
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Sa 05.02.05 12:43 
Sie hat auch keinen Sinn. Erstens wird der übergebene Parameter ignoriert, und zweitens wird nichts berechnet.
Aber ich denke mal, dass die Funktion so nicht komplett ist.

_________________
We are, we were and will not be.