Jak pozbyć się błędu "';' expected but '.' found"?

0

Cześć, nie mogę sobie poradzić z usunięciem tego błędu. Tworze prosty arkusz kalkulacyjny według poradnika. Pozdrawiam.

Arkusz.jpg

dodanie obrazka do treści posta - @furious programming

1

Prawdopodobnie zapomniałeś gdzieś domknąć end; do pary z begin. Pokaż więcej kodu jak byś nie znalazł błędu i umieść go tutaj w znaczniku <code class="delphi"></code>

2

I sformatuj od razu bo na screenie widać, że masz w głębokim poważaniu formatowanie kodu i między innymi dlatego ten błąd Ci wyskoczzył. Jak sformatujesz kod to powinieneś sam znaleźć przyczynę.

0
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms,
Dialogs, ExtCtrls, Grids, StdCtrls, Buttons;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Panel1: TPanel;
Button1: TButton;
Panel2: TPanel;
Panel3: TPanel;
Button2: TButton;
Panel4: TPanel;
BitBtn1: TBitBtn;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var X, Y, Z:Single;
i:Byte;
 begin
  x:=0;
  for i:=1 to 6 do
   begin
    if StringGrid1.Cells[1, i]=' ' then
     begin
      StringGrid1.Cells[1, i]:=' 0 ';
 end;

x:=x + STrToFLoat(StringGrid1.Cells[1, i]);
Panel1.caption:=FloatToStrF(X, ffGeneral, 5, 2);

   end;

Y:=0;
for i:=1 to 6 do
 begin
  if StringGrid1.Cells[2, i]=' ' then
   begin
    StringGrid1.Cells[2, i]:=' 0 ';
 end;

Y:=Y + STrToFLoat(StringGrid1.Cells[2, i]);
Panel2.caption:=FloatToStrF(Y, ffGeneral, 5, 2);
   end;

Z:=0;
for i:=1 to 6 do
 begin
  if StringGrid1.Cells[3, i]=' ' then
   begin
    StringGrid1.Cells[3, i]:=' 0 ';
 end;

Z:=Z + STrToFLoat(StringGrid1.Cells[3, i]);
Panel3.caption:=FloatToStrF(Z, ffGeneral, 5, 2);
end;

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
StringGrid1.Cells[0,0]:='Nazwa';
StringGrid1.Cells[1,0]:='Cena jedn.';
StringGrid1.Cells[2,0]:='Ilość';
StringGrid1.Cells[3,0]:='Ogółem';
StringGrid1.Cells[0,1]:='Dysk';
stringGrid1.Cells[0,2]:='Płyta';
StringGrid1.Cells[0,3]:='Myszka';
StringGrid1.Cells[0,4]:='Pamięć';
StringGrid1.Cells[0,5]:='Obudowa';
StringGrid1.Cells[0,6]:='Monitor';
end;

procedure TForm1.Button2Click(Sender: TObject);
Var X:Single;
i:Byte;
 begin
  for i:=1 to 6 do
   begin
    if StringGrid1.Cells[1, i]='' then
    StringGrid1.Cells[1, i]:=' 0 ';
      if StringGrid1.Cells[2, i]=' ' then
      StringGrid1.Cells[2, i]:=' 0 ';
 end;

X:=StrToFloat(StringGrid1.Cells[1,1])*
StrToFloat(StringGrid1.Cells[2,1]);
StringGrid1.Cells[3,1]:=FLoatToStrF(x, ffGeneral, 5, 2);
X:=StrToFloat(StringGrid1.Cells[1,2])*
StrToFloat(StringGrid1.Cells[2,2]);
StringGrid1.Cells[3,2]:=FLoatToStrF(x, ffGeneral, 5, 2);
X:=StrToFloat(StringGrid1.Cells[1,3])*
StrToFloat(StringGrid1.Cells[2,3]);
StringGrid1.Cells[3,3]:=FLoatToStrF(x, ffGeneral, 5, 2);
X:=StrToFloat(StringGrid1.Cells[1,4])*
StrToFloat(StringGrid1.Cells[2,4]);
StringGrid1.Cells[3,4]:=FLoatToStrF(x, ffGeneral, 5, 2);
X:=StrToFloat(StringGrid1.Cells[1,5])*
StrToFloat(StringGrid1.Cells[2,5]);
StringGrid1.Cells[3,5]:=FLoatToStrF(x, ffGeneral, 5, 2);
X:=StrToFloat(StringGrid1.Cells[1,6])*
StrToFloat(StringGrid1.Cells[2,6]);
StringGrid1.Cells[3,6]:=FLoatToStrF(x, ffGeneral, 5, 2);
end;

procedure TForm1.Button3Click(Sender: TObject);
Var i, j: Byte;
 begin
  for i:=1 to StringGrid1.ColCount-1 do

  for j:=1 to StringGrid1.RowCount-1 do

StringGrid1.Cells[i, j]:=' ';

Panel1.Caption:=' ';
Panel2.Caption:=' ';

Panel3.Caption:=' ';
 end;

procedure Arkusz.StringGrid1KeyPress(Sender: TObject; var Key:Char);

begin

Case Key Of
'0'..'9',#8,',':

;
else
Key:=#0;

end;
end;
end.

Myśle nad tym i nic nie moge wykombinowac... laik ze mnie :(

2

a co to za klasa Arkusz? Nic takiego w tym kodzie nie istnieje. Jeśli chcesz wygenerować metodę dla zdarzenia StringGrid1KeyPress kliknij na StringGrid w Object Inspector na zakładce Events odszukaj Zdarzenia on KeyPress i sobie je wygeneruj.

0

Wiem zamiast arkusz miało byc Tform1. Wygenerowałem sobie to zdarzenie i wszystko ruszyło. Dziękuje za szybka i skuteczna pomoc. Pozdrawiam :)

1 użytkowników online, w tym zalogowanych: 0, gości: 1