AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Hilfe mit Dateien

Ein Thema von qb-tim · begonnen am 16. Mai 2006 · letzter Beitrag vom 17. Mai 2006
 
Benutzerbild von qb-tim
qb-tim

Registriert seit: 3. Mär 2006
Ort: Deutschland
280 Beiträge
 
Delphi 6 Professional
 
#10

Re: Hilfe mit Dateien

  Alt 17. Mai 2006, 14:37
Danke himitsu

Die Befehle habe ich gesucht!

Mein Programm sieht jetzt so aus:

Delphi-Quellcode:
procedure TForm1.FormActivate(Sender: TObject);
var x, y : Integer;
begin
  for x := 1 to 9 do
    for y := 1 to 9 do
    begin
      Edit[x, y] := TEdit.Create(Self);
      Edit[x, y].Parent := Form1;
      Edit[x, y].Height := 25;
      Edit[x, y].Width := 25;
      Edit[x, y].Text := '0';
    end;
  for x := 1 to 9 do
  begin
    Edit[x, 1].Top := 8;
    Edit[x, 2].Top := 32;
    Edit[x, 3].Top := 56;
    Edit[x, 4].Top := 88;
    Edit[x, 5].Top := 112;
    Edit[x, 6].Top := 136;
    Edit[x, 7].Top := 168;
    Edit[x, 8].Top := 192;
    Edit[x, 9].Top := 216;
  end;
  for y := 1 to 9 do
  begin
    Edit[1, y].Left := 8;
    Edit[2, y].Left := 32;
    Edit[3, y].Left := 56;
    Edit[4, y].Left := 88;
    Edit[5, y].Left := 112;
    Edit[6, y].Left := 136;
    Edit[7, y].Left := 168;
    Edit[8, y].Left := 192;
    Edit[9, y].Left := 216;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
Var x, y, z : Integer;
Var tmp : String;
Var myFile: File of Integer;

begin

tmp := Edit1.Text;

//schreiben
AssignFile(myFile, tmp);
Rewrite(myFile);
for x := 1 to 9 do
  for y := 1 to 9 do
  begin
    z := StrToInt(Edit[x,y].Text);
    Write(myFile, z);
  end;
CloseFile(myFile);

//lesen
AssignFile(myFile, tmp);
Reset(myFile);
for x := 1 to 9 do
  for y := 1 to 9 do
  begin
    Read(myFile, z);
    Edit[x,y].Text := IntToStr(z);
    if z = 0 then
      Edit[x,y].Text := '';
  end;
CloseFile(myFile);

end;
Es ist nur ein Testprogramm also ist es nichts Bewundernswertes...

  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:07 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz