Autor Beitrag
sklorzy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Sa 24.04.04 18:02 
Hi,
kann mir jemand sagen, wie ich die Cells und Rows der Stringrid in einem oder zwei Textdateien abspeichern kann, insofern die überhaupt möglich ist.


Danke schon mal im Voraus
orakel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 92

Win XP

BeitragVerfasst: Sa 24.04.04 18:08 

_________________
Nicht verzagen, orakel fragen!
sklorzy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Sa 24.04.04 19:30 
Titel: Da kommt ne Fehlermeldung
ich hab mir den text kopiert und als ich kompeliert habe, gas eine Fehlemeldung

[Fehler] Unit1.pas(46): Undefinierter Bezeichner: 'gridspeichern'
Was kann ich dagegen tun :? ??
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Sa 24.04.04 20:24 
steht die Procedure vor dem Aufruf? am besten, du rückst etwas COde raus :)

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
sklorzy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: So 25.04.04 08:51 
Titel: Quelltext
Das ist der Quelltext

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:
interface

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

type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    MainMenu1: TMainMenu;
    Datei1: TMenuItem;
    NeuerEintrag1: TMenuItem;
    Eintragbearbeiten1: TMenuItem;
    Eintraglschen1: TMenuItem;
    N1: TMenuItem;
    Beenden1: TMenuItem;
    Beendenohnezuspeichern1: TMenuItem;
    Image1: TImage;
    ComboBox1: TComboBox;
    procedure NeuerEintrag1Click(Sender: TObject);
    procedure Beenden1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  
implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.NeuerEintrag1Click(Sender: TObject);
begin
form2.show;
end;

procedure TForm1.Beenden1Click(Sender: TObject);
begin
gridspeichern(StringGrid1,'c:\test.grd'); form1.Close;

end;
procedure gridspeichern(grd:TStringGrid;Datei:string); 
var 
  sl:TStringlist; 
  x,y:integer; 
begin 
  sl:=TStringlist.create; 
  sl.add(inttostr(grd.colcount)); 
  sl.add(inttostr(grd.rowcount)); 
  for x:=0 to grd.ColCount-1 do 
    for y:=0 to grd.RowCount-1 do 
      sl.add(grd.cells[x,y]); 
    for x:=0 to grd.ColCount-1 do 
      sl.add(inttostr(grd.ColWidths[x])); 
    for x:=0 to grd.RowCount-1 do 
      sl.add(inttostr(grd.RowHeights[x])); 
    sl.add(inttostr(grd.clientwidth)); 
    sl.add(inttostr(grd.clientheight)); 
    sl.add(inttostr(ord(grd.ScrollBars))); 
    sl.savetofile(datei); 
    sl.free; 
end; 

end.
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: So 25.04.04 09:40 
Titel: Re: Quelltext
dürfte funktionieren:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
{...}
var
  Form1: TForm1;
  procedure gridspeichern(grd:TStringGrid;Datei:string);  // <--- !!!

  
implementation

uses Unit2;
{...}

btw: benutz doch bitte die delphi tags anstelle der Code Tags...


raziel

_________________
JSXGraph
sklorzy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: So 25.04.04 10:04 
Titel: Danke
Danke