Autor Beitrag
Jagg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 635



BeitragVerfasst: Do 22.08.02 16:06 
ausblenden volle Höhe 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:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
unit Material1;

interface

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

type
  TForm11 = class(TForm)
    Image1: TImage;
    Label1: TLabel;
    Edit1: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);

  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
Form11: TForm11;
var WelcheSeite,F11Anz:Integer;
L1,L2,L3 : array [1..99] of TLabel;
TE : array [1..99] of TEdit;

implementation

uses Material;

{$R *.DFM}

procedure TForm11.FormCreate(Sender: TObject);
 var T  : TTable;
     D  : TDataSource;
     i,a  : integer;
begin
  i := 1;
  F11Anz := 1;
  a := 0;
  Image1.Picture.LoadfromFile ('F:\Kasse\ProgrammDaten\Panel1.bmp');
  T := TTable.Create(form11);
  T.DatabaseName := 'C:\Nguyen\Info Post Programm\';
  T.TableName := 'Material1.dbf';
  T.Active := True;
  D := TDataSource.Create(form11);
  D.DataSet := T;
  while not T.eof do
  begin
    if (T['Artnr']>=WelcheSeite)and(T['Artnr']<=WelcheSeite+99) then
    begin
      L1[F11Anz] := TLabel.create(Form11);
      L1[F11Anz].parent := Form11;
      with L1[F11Anz] do
      begin
        Caption :=T['Artnr'];
        Font.Name := 'Lucida Console';
        Font.Size := 9;
        Font.Style := [fsBold];
        Top := i*20;
        Left := 40+a*300;
        Transparent := True;
      end;
      L2[F11Anz] := TLabel.create(Form11);
      L2[F11Anz].parent := Form11;
      with L2[F11Anz] do
      begin
        Caption :=T['Wasdenn'];
        Font.Name := 'Lucida Console';
        Font.Size := 9;
        Font.Style := [fsBold];
        Top := i*20;
        Left := 70+A*300;
        Transparent := True;
      end;
      L3[F11Anz] := TLabel.create(Form11);
      L3[F11Anz].parent := Form11;
      with L3[F11Anz] do
      begin
        Caption :=T['Einheit'];
        Font.Name := 'Lucida Console';
        Font.Size := 9;
        Font.Style := [fsBold];
        Top := i*20;
        Left := 270+A*300;
        Transparent := True;
      end;
      TE[F11Anz]:= TEdit.create(Form11);
      TE[F11Anz].parent := Form11;
      with TE[F11Anz] do
      begin
        Font.Name := 'Lucida Console';
        Font.Size := 9;
        Font.Style := [fsBold];
        Top := i*20;
        Left := 320+A*300;
        Width := 25;
        OnKeyPress := Edit1KeyPress;
      end;
      inc(i);
      inc(F11Anz);
      if i = 25 then
      begin
       a := 1;
       i := 1;
      end;
    end;
    a := a+1; 
    T.next;
    end;
  T.free;
  D.free;
end;


Er sagt mir die meldung "Ungültige Typumwandlung"

Titel geändert. TINO
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Do 22.08.02 17:16 
Bei 118 Zeilen Code wäre es von Vorteil wenn wir wüssten in welcher Zeile dieser Fehler auftritt!
Ex0rzist
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 550

Win XP Prof.
Mandrake 10.0

D6
BeitragVerfasst: Do 22.08.02 18:04 
Hallo,

also ich würde mal stark vermuten, dass es an:

...Caption := T['ArtNr']; liegt.

TLabel.Caption und TTable sind nun alles andere als kompatibel zueinander.


@Tino
Hast du die Zeilen abgezählt? :mrgreen:

__________

Ex0rzist
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Fr 23.08.02 09:28 
Ex0rzist hat folgendes geschrieben:
Hast du die Zeilen abgezählt? :mrgreen:

Ne, kopiert und in den Editor eingefügt :-D
Jagg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 635



BeitragVerfasst: Fr 23.08.02 11:06 
hehehe
ich weiss ja selber nicht in weclher zeile der fehlerl liegt
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: Fr 23.08.02 11:27 
Jagg hat folgendes geschrieben:
ich weiss ja selber nicht in weclher zeile der fehlerl liegt


Wenn dir der Fehler gemeldet wird Makiert Delphi eine Zeile. In dieser liegt für gewöhnlich der Fehler :!:
Jagg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 635



BeitragVerfasst: Fr 23.08.02 11:37 
er sagt den fehler bei "application.run"

ALso könnt ihr mich jemand jetzt helfen ???
Günter
Hält's aus hier
Beiträge: 9



BeitragVerfasst: Fr 23.08.02 12:33 
Hallo Jagg,

Der Fehler tritt immer vor der markierten Zeile auf --> Da dürfte etwas stehen wie
ausblenden Quelltext
1:
Application.CreateForm(TForm11, Form11);					


Das heisst, der Fehler tritt wohl im 'FormCreate' auf --> setz doch da mal einen Debug-Punkt ('F5') am anfang von 'FormCreate' und debug den Code schrittweise durch ('F8').

Dann müsste der Fehler zu lokalisieren sein.

Gruss Günter
Jagg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 635



BeitragVerfasst: Mi 18.09.02 08:52 
ich find den fehler immer noch nicht,ich weiss nicht was ich machen soll,kann mir jemand helfen ???
ich habe debuggt un da wo der fehler liegt,weiss ich nicht was ich machen soll !

Der Fehler liegt in der Zeile wo : "D.Free und T.Free" steht !

Kann mir jemand helfen ????????????????????????????????????ß
wwerner
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 185



BeitragVerfasst: Mi 18.09.02 09:07 
Hi Jagg,

erst einmal, was für ein Fehkler kommt den?
2. Was machst du mit D (Datasource)
3. Die Tabelle muß vor den t.free auch geschlossen werden

_________________
Gruß

Wolfgang

----------
zu hause ist es doch am schönsten
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Mi 18.09.02 09:35 
Hi Jagg
der Fehler liegt im Inhalt deiner Tabelle. Du verwendest z. B.
ausblenden Quelltext
1:
2:
3:
    if (T['ArtNr']>=WelcheSeite)and(T['ArtNr']<=WelcheSeite+99)
     then
     ...

oder
ausblenden Quelltext
1:
2:
3:
  ...
  Caption :=T['ArtNr'];
  ...

An diesen Stellen finden lauter Variant-Typumwandlungen statt. Solange im betreffenden Feld ein Wert steht, kein Problem. Wenn der Feldinhalt aber leer ist, also Null dann krachts.
Entweder verwendest du eine expliziten Konvertierungsmethode der Felder (T['ArtNr'].AsInteger) oder du verwendest die IsNull Methode um sicherzustellen, dass kein Feld ohne Inhalt behandelt wird.

Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
Jagg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 635



BeitragVerfasst: Mi 18.09.02 09:35 
wenn ich das programm wie ganz am anfang beschrieben starte sagt er "ungültige typumwandlung" aber wenn ich jetzt da wo "T.next" steht davor die Zeile "end;" schreibe,geht er zu "T.free" und sag mir die meldung,deklaration erwartet,aber bezeichner 'T' gefunden !

ich versteh die welt nicht mehr !
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Mi 18.09.02 09:37 
Wow, zeitgleich :!:
Guck mal das Posting vorher an.

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
Jagg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 635



BeitragVerfasst: Mi 18.09.02 10:07 
wenn ich jetzt die

ausblenden Quelltext
1:
(T['ArtNr']<=WelcheSeite+99)					


die "99" weglasse funktioniert das programm !

Warum ?