unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, XPMan; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Label1: TLabel; Label2: TLabel; Edit1: TEdit; Edit2: TEdit; Label3: TLabel; procedure Button2Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Edit1KeyPress(Sender: TObject; var Key: Char); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation uses Unit2, Grids; {$R *.dfm} procedure TForm1.Button2Click(Sender: TObject); begin if MessageDlg('Вы действительно хотите выйти из программы!',mtWarning,[mbYes,mbNo],0) =mrYes then begin Close; Application.Terminate; end; end; procedure TForm1.Button1Click(Sender: TObject); begin if (Edit1.Text='')or (StrToInt(Edit1.Text)=0) then MessageDlg('Не введено количество строк!',mtWarning,[mbOK],0) else if (Edit2.Text='')or (StrToInt(Edit2.Text)=0) then MessageDlg('Не введено количество столбцов!',mtWarning,[mbOK],0) else begin form2.Show; form2.StringGrid1.Show; form2.StringGrid2.Show; form2.StringGrid3.Show; form2.StringGrid4.Hide; form2.StringGrid5.Hide; form1.Hide; form2.StringGrid1.RowCount:=StrToInt(Edit1.Text); form2.StringGrid1.ColCount:=StrToInt(Edit2.Text); Form2.StringGrid2.RowCount:=StrToInt(Edit1.Text); Form2.StringGrid3.ColCount:=StrToInt(Edit2.Text); Form2.StringGrid7.RowCount:=StrToInt(Edit1.Text); Form2.StringGrid6.ColCount:=StrToInt(Edit2.Text); Form2.StringGrid4.RowCount:=Form2.StringGrid1.RowCount; Form2.StringGrid4.ColCount:=Form2.StringGrid1.ColCount; Form2.StringGrid5.RowCount:=Form2.StringGrid1.RowCount; Form2.StringGrid5.ColCount:=Form2.StringGrid1.ColCount; end; end; procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if (key<>'0') then if (key<>'1') then if (key<>'2') then if (key<>'3') then if (key<>'4') then if (key<>'5') then if (key<>'6') then if (key<>'7') then if (key<>'8') then if (key<>'9') then if (key<>chr(8)) then begin key:=#0; MessageDlg('В поле ввода нужно вводить числовое значение!',mtWarning,[mbOK],0) end; end; end.