Autor Beitrag
Andi08
Hält's aus hier
Beiträge: 1



BeitragVerfasst: Di 10.02.09 08:10 
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:
unit Schleifen_A3;

interface

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

type
  TForm1 = class(TForm)
    MainMenu1: TMainMenu;
    Datei1: TMenuItem;
    Beenden1: TMenuItem;

    Berechnen1: TMenuItem;
    Info1: TMenuItem;
    EdStart: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    EdEnd: TEdit;
    LvAusgabe: TListView;
    procedure Berechnen1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Berechnen1Click(Sender: TObject);
var
Startzahl : Integer;
Endzahl : Integer;
Zaehlvariable : Integer;
AusgabeZeile : Integer;
AusgabeSpalte : Integer;
Zahl : String;
Teiler : String;
Ergebnis : String;
Puffer : Integer;
begin

Startzahl := StrtoInt (EdStart.Text);
Endzahl := StrtoInt (EdEnd.Text);
for Zaehlvariable := Startzahl to Endzahl do
  begin
    if (Zaehlvariable mod 3) = 0 then
    begin
      Zahl := InttoStr (Zaehlvariable);
      Teiler := InttoStr (3);
      Puffer := Zaehlvariable div 3;
      Ergebnis := InttoStr (Puffer);
      LvAusgabe.AddItem('Zahl ^I Teiler ^I Ergebnis');
    end;
    if (Zaehlvariable mod 5) = 0 then
    begin
      Zahl := InttoStr (Zaehlvariable);
      Teiler := InttoStr (5);
      Puffer := Zaehlvariable div 5;
      Ergebnis := InttoStr (Puffer);
      LvAusgabe.AddItem('Zahl ^I Teiler ^I Ergebnis');
    end;

  end;
end;

end.

Hoffe ihr könnt mir helfen!

MFG Andi

Moderiert von user profile iconGausi: Delphi-Tags hinzugefügt
Moderiert von user profile iconGausi: B- durch Highlight-Tags ersetzt
Moderiert von user profile iconNarses: Titel geändert.
Ulixes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 63

Win Vista Home Premium
Delphi 2009 Professional, XHTML, CSS, PHP
BeitragVerfasst: Di 10.02.09 08:56 
Hallo und :welcome: !

Mach bitte Delphitags um deinen Quelltext.

Wenn ich das richtig verstehe, willst du die Daten in eine Listbox einlesen??

Das macht man so:

ausblenden Delphi-Quelltext
1:
listbox1.items.add();					


Ich hoffe, dass es dir weiterhilft.

MFG
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 10.02.09 10:55 
Moin und :welcome: im Forum!

Items in einem Listview legt man z.B. so an:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
  var
    ListItem: TListItem;
begin
  ListItem := ListView1.Items.Add;
  ListItem.Caption := 'Titel'; // Text der ersten Spalte
  ListItem.SubItems.Add('2. Spalte');
  ListItem.SubItems.Add('3. Spalte');
  //...
cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.