Autor Beitrag
broiler1983
Hält's aus hier
Beiträge: 9



BeitragVerfasst: So 27.06.04 18:52 
Ist soweit alles ok.
nur mit der Ausgabe klappt es noch nicht so ganz. Es wird immer nur die erste zahl vom betrag gelesen und ist die kleiner als der eingegebene Betrag zeigt er die zahl nicht an :?:

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:
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:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
nit Kundendatei;

interface

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

type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    Button1: TButton;
    Button2: TButton;
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);

  private
    { Private-Deklarationen }
  public

    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var

i:integer;
a:integer ;
begin
    i:=0;
    a:=0;
    repeat
    i:=i+1;
    a:=a+1;
    stringgrid1.Cells[0,i]:=floattostr(a);
     edit1.Text:=formatfloat ('.000',a);
    until i+1>11;


    stringgrid1.Cells[1,0]:='Kundenname';
    stringgrid1.cells[2,0]:='Kundennummer';
    stringgrid1.Cells[3,0]:='Rechnungsbetrag' ;

    stringgrid1.Cells[3,1]:='23';
    stringgrid1.Cells[3,2]:='1';
    stringgrid1.Cells[3,3]:='22';
    stringgrid1.Cells[3,4]:='4';
    stringgrid1.Cells[3,5]:='6';
    stringgrid1.Cells[3,6]:='15';
    stringgrid1.Cells[3,7]:='66';
    stringgrid1.Cells[3,8]:='22';



end;

procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;

  procedure TForm1.Button1Click(Sender: TObject);
  var
  u:integer ;
  a:integer  ;
  j:integer;
begin   
  u:=1;
  a:=1;
  j:=0;
  repeat j:= j+1;
  if form1.stringgrid1.Cells[3,j] > form1.edit1.Text then
  u:= u+1;
  if form1.stringgrid1.cells[3,j]>form1.edit1.text then
  begin
  form2.stringgrid1.cells [1,a]:=form1.stringgrid1.cells [1,j];
  form2.stringgrid1.cells [2,a]:=form1.stringgrid1.cells [2,j];
  form2.stringgrid1.cells [3,a]:=form1.stringgrid1.cells [3,j];
  a:=a+1;
  end;

  until j>11 ;
  form2.stringgrid1.RowCount:=u;
  form2.show;
end;

end.


unit Unit2;

interface

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

type
  TForm2 = class(TForm)
    StringGrid1: TStringGrid;
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.FormCreate(Sender: TObject);
var
i,a: integer;
begin
   i:=0;
   a:=0;
   repeat
    i:=i+1;
    a:=a+1;
    stringgrid1.Cells[0,i]:=floattostr(a);

    until i+1>11;
    stringgrid1.Cells[1,0]:='Kundenname';
    stringgrid1.cells[2,0]:='Kundennummer';
    stringgrid1.Cells[3,0]:='Rechnungsbetrag';
    end;




end.



Müssen die Variablen vielleicht anders deklariert werden?



Moderiert von user profile iconPeter Lustig: Delphi-Tags hinzugefügt.
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: So 27.06.04 19:12 
setz bitte deine codes in delphi tags und versuch dich auf die wesentlichen Bestandteile zu konzentrieren und zu posten

Zitat:

if form1.stringgrid1.Cells[3,j] > form1.edit1.Text then

du mußt die auch in zahlen wandlen, so vergleichst du nur Texte alphabetisch

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
broiler1983 Threadstarter
Hält's aus hier
Beiträge: 9



BeitragVerfasst: So 27.06.04 19:26 
is ja alles klar. aber wie und wo wandle ich das in zahlen um
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: So 27.06.04 19:28 
broiler1983 hat folgendes geschrieben:
is ja alles klar. aber wie und wo wandle ich das in zahlen um


das habe ich dir schon in deinem ersten Beitrag gesagt, strtoint/strtofloat, ja nach Zahlentyp

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
broiler1983 Threadstarter
Hält's aus hier
Beiträge: 9



BeitragVerfasst: So 27.06.04 20:21 
Danke für deine Hilfe :D
broiler1983 Threadstarter
Hält's aus hier
Beiträge: 9



BeitragVerfasst: Mo 28.06.04 07:01 
Moin, moin!
Ich weiß das klingt jetzt sicher blöd, aber vielleicht bin ich es ja auch. Kannst du mir nochmal genau sagen an welcher stelle des Quelltextes ich in zahlen umwandeln muss.
Bin noch etwas schwer von Begriff :wink: