1)кнопка
2)кнопка
3)кнопка
Код: Выделить всё
procedure TTab.N2Click(Sender: TObject);
var
f:TextFile;
s:string;
c:Char;
m,i,j,n:integer;
begin
If OpenDialog1.Execute then
begin
AssignFile(f,OpenDialog1.FileName);
edit1.text:=OpenDialog1.FileName;
i:=0;
j:=1;
n:=1;
reset(f);
while not eof(f) do
begin
read(f,c);
if (c<>'&') and (c<>'?') then s:=s+c;
if c='&' then begin
stringgrid1.Cells[i,j]:=s;
i:=i+1;
s:='';
end;
if c='?' then begin
stringgrid1.Cells[i,j]:=s;
j:=j+1;
i:=0;
s:='';
n:=n+1;
stringgrid1.rowcount:=n+1;
end;
end;
closefile(f);
if edit1.Text <> '' then
begin
end;
end;
end;
Код: Выделить всё
procedure TTab.N3Click(Sender: TObject);
var
w:string;
I:Byte;
F:TextFile;
S:String;
begin
w:=getcurrentdir;
if Tab.Edit1.Text='' then
begin
If SaveDialog1.Execute then
begin
AssignFile(F,SaveDialog1.FileName);
edit1.Text:=SaveDialog1.FileName;
ReWrite(F);
For I:=1 to StringGrid1.RowCount-2 do
begin
S:=StringGrid1.Cells[0,I]+'&'+StringGrid1.Cells[1,I]+'&'+StringGrid1.Cells[2,I]+'&'+StringGrid1.Cells[3,I]+'&'+StringGrid1.Cells[4,I]+'&'+StringGrid1.Cells[5,I]+'?';
Write(F,S);
end;
CloseFile(F);
end;
Savedialog1.Destroy;
end
else
begin
AssignFile(F,edit1.Text);
ReWrite(F);
For I:=1 to StringGrid1.RowCount-2 do
begin
S:=StringGrid1.Cells[0,I]+'&'+StringGrid1.Cells[1,I]+'&'+StringGrid1.Cells[2,I]+'&'+StringGrid1.Cells[3,I]+'&'+StringGrid1.Cells[4,I]+'&'+StringGrid1.Cells[5,I]+'?';
Write(F,S);
end;
CloseFile(F);
end;
end;
Код: Выделить всё
procedure TForm7.Button1Click(Sender: TObject);
var
i,j,g:integer;
begin
For i:=1 to Tab.StringGrid1.RowCount-2 do
For j:=0 to Tab.StringGrid1.ColCount do
begin
form7.StringGrid1.Cells[j,i]:=''
end;
Form7.StringGrid1.RowCount:=Tab.StringGrid1.RowCount;
if form7.RadioGroup1.ItemIndex=0 then g:=2 else g:=5;
For i:=1 to Tab.StringGrid1.RowCount-2 do
For j:=0 to Tab.StringGrid1.ColCount do
if strtoint(edit1.text)>=strtoint(Tab.StringGrid1.cells[g,i]) then
begin
form7.StringGrid1.Cells[j,i]:=Tab.StringGrid1.Cells[j,i];
end;
end;