• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 793
  • Last Modified:

Just a quick simple one - if/then/else syntax!

Below is my code, somehow managed to mess up the syntax but my tired eyes can't see where I've gone wrong!

Cheers!
procedure TFrmEPOS.BtnTransactionVoidClick(Sender: TObject);
var count: integer;
begin
  if BtnEposTotal.Enabled = true then
    for count := 0 to Strrow do
      StrGridTransaction.Cells[1,Strrow]:='';
      StrGridTransaction.Cells[0,Strrow]:='';
    else
      Strrow := Strrow +1;
      for count := 0 to Strrow do
        StrGridTransaction.Cells[1,Strrow]:='';
        StrGridTransaction.Cells[0,Strrow]:='';
      MmoTransactionTotal.Text:='';
      BtnEposAdd.Enabled := true;
      BtnEposDelete.Enabled := true;
      BtnEposQuantity.Enabled := true;
      BtnEposTotal.Enabled := true;
end;
 
end.

Open in new window

0
TTRMW
Asked:
TTRMW
1 Solution
 
HypoCommented:
I guess is that it should be like this... :)

/Hypo
procedure TFrmEPOS.BtnTransactionVoidClick(Sender: TObject);
var count: integer;
begin
  if BtnEposTotal.Enabled = true then begin
    for count := 0 to Strrow do begin
      StrGridTransaction.Cells[1,Strrow]:='';
      StrGridTransaction.Cells[0,Strrow]:='';
    end;
  end else begin
    Strrow := Strrow +1;
    for count := 0 to Strrow do begin
      StrGridTransaction.Cells[1,Strrow]:='';
      StrGridTransaction.Cells[0,Strrow]:='';
    end;
    MmoTransactionTotal.Text:='';
    BtnEposAdd.Enabled := true;
    BtnEposDelete.Enabled := true;
    BtnEposQuantity.Enabled := true;
    BtnEposTotal.Enabled := true;
  end;
end;

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now