Все привет!!! Вот код программы
| Код | unit test;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) ComboBox1: TComboBox; Edit2: TEdit; Edit3: TEdit; Button1: TButton; Label1: TLabel; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1; egtr, ndoc, nd1, nd2, nd3, nd4, nd5, nd6, nd7, nd8, nd9, len: Integer; npas, l, s1, s2, s3, s4, s5, s6, s7, s8, s9, filename: string; myfile: TextFile; procedure passport(egtr,ndoc: Integer); implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject); begin filename:='Count.ini'; if FileExists(filename) then begin AssignFile(myfile, 'Count.ini'); Reset(myfile); ReadLN(myfile, s1); nd1:=StrToInt(s1); ReadLN(myfile, s2); nd2:=StrToInt(s2); ReadLN(myfile, s3); nd3:=StrToInt(s3); ReadLN(myfile, s4); nd4:=StrToInt(s4); ReadLN(myfile, s5); nd5:=StrToInt(s5); ReadLN(myfile, s6); nd6:=StrToInt(s6); ReadLN(myfile, s7); nd7:=StrToInt(s7); ReadLN(myfile, s8); nd8:=StrToInt(s8); ReadLN(myfile, s9); nd9:=StrToInt(s9); CloseFile(myfile); end; AssignFile(myfile, 'Count.ini'); Rewrite(myfile); if ComboBox1.ItemIndex=0 then begin egtr:=1; nd1:=nd1+1; WriteLN(myfile, IntToStr(nd1)); passport(egtr, nd1); end; if ComboBox1.ItemIndex=1 then begin egtr:=2; nd2:=nd2+1; passport(egtr, nd2); WriteLN(myfile, IntToStr(nd2)); end; if ComboBox1.ItemIndex=2 then begin egtr:=3; nd3:=nd3+1; passport(egtr, nd3); writeLN(myfile, IntToStr(nd3)); end; if ComboBox1.ItemIndex=3 then begin egtr:=4; nd4:=nd4+1; passport(egtr, nd4); writeLN(myfile, IntToStr(nd4)); end; if ComboBox1.ItemIndex=4 then begin egtr:=5; nd5:=nd5+1; passport(egtr, nd5); writeLN(myfile, IntToStr(nd5)); end; if ComboBox1.ItemIndex=5 then begin egtr:=6; nd6:=nd6+1; passport(egtr, nd6); writeLN(myfile, IntToStr(nd6)); end; if ComboBox1.ItemIndex=6 then begin egtr:=7; nd7:=nd7+1; passport(egtr, nd7); writeLN(myfile, IntToStr(nd7)); end; if ComboBox1.ItemIndex=7 then begin egtr:=8; nd8:=nd8+1; passport(egtr, nd8); writeLN(myfile, IntToStr(nd8)); end; if ComboBox1.ItemIndex=8 then begin egtr:=9; nd9:=nd9+1; passport(egtr, nd9); writeLN(myfile, IntToStr(nd9)); end; CloseFile(myfile); Edit3.Text:=npas; Label1.Caption:=l; end; procedure passport(egtr, ndoc: Integer); begin len:=Length(npas); npas:='0'+IntToStr(egtr)+'-'+'000'+IntToStr(ndoc); l:=IntToStr(len); end; end.
|
Запускается, но при выборе ComboBox выдает сообщение ( см. рисунок) |