Why am I getting the error Declaration expected but identifier lblCommStatus found?

Hi I have the following code

unit WirelessLoading;

interface

uses
   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ComCtrls, AdPort, OoMisc, AdProtcl, ExtCtrls, Buttons, serialComm,
  profileInterface, registry, AdPStat, jpeg;

type
  TfrmWirelessLoading = class(TForm)
    Image1: TImage;
    lblCommStatus: TLabel;
    loadProgress: TProgressBar;
    //procedure lblCommStatusClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;


//procedure Testing;
var
  frmWirelessLoading: TfrmWirelessLoading;
  lblCommStatus: TLabel;
  loadProgress: TProgressBar;
  //lblCommStatus: string;
  //loadProgress: TProgressBar;
  //lblCommStatus: string;

implementation
    //begin
{$R *.DFM}

      lblCommStatus.Caption := 'Loading Please Wait';
      lblCommStatus.Repaint;
      loadProgress.Max := 100;
      loadProgress.Position := 10;
      lblCommStatus.Caption := 'Loading Please Wait';
      lblCommStatus.Repaint;
      sleep(500);
      loadProgress.Position := 80;
      lblCommStatus.Caption := '';
      lblCommStatus.Repaint;
      Sleep(500);
      lblCommStatus.Caption := 'Loading Please Wait';
      lblCommStatus.Repaint;
      sleep(500);


end.



*** I am getting the error declaration expected on lblCommStatus, if i comment it I also get it on the progressload..... I have both elements on the design form.
FreedayAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SuperdaveCommented:
You don't have a procedure declaration at the start of the implementation section.
0
thiagoblimeiraCommented:
You don't need to declare them again in the var clause, there are in the form declaration already
0
8080_DiverCommented:
Try looking and testing at the following code.  You might want to review the process of designing a form, as well.
When you add an On Click event handler, you need to put the code in that event handler instead of deleting the procedure definition lines of it. ;-)

unit WirelessLoading;

interface

uses
   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ComCtrls, AdPort, OoMisc, AdProtcl, ExtCtrls, Buttons, serialComm,
  profileInterface, registry, AdPStat, jpeg;

type
  TfrmWirelessLoading = class(TForm)
    Image1: TImage;
    lblCommStatus: TLabel;
    loadProgress: TProgressBar;
    //procedure lblCommStatusClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;


//procedure lblCommStatusClick(Sender: TObject);
var
  //frmWirelessLoading: TfrmWirelessLoading;
  //lblCommStatus: TLabel;
  //loadProgress: TProgressBar;
  //lblCommStatus: string;
  //loadProgress: TProgressBar;
  //lblCommStatus: string;

implementation
{$R *.DFM}
  procedure lblCommStatusClick(Sender: TObject);  // ADDED
  begin                                           // ADDED
    lblCommStatus.Caption := 'Loading Please Wait';
    lblCommStatus.Repaint;
    loadProgress.Max := 100;
    loadProgress.Position := 10;
    lblCommStatus.Caption := 'Loading Please Wait';
    lblCommStatus.Repaint;
    sleep(500);
    loadProgress.Position := 80;
    lblCommStatus.Caption := '';
    lblCommStatus.Repaint;
    Sleep(500);
    lblCommStatus.Caption := 'Loading Please Wait';
    lblCommStatus.Repaint;
    sleep(500);
  end;                                           // ADDED

end.

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FreedayAuthor Commented:
Thank you, I want this code to execute everytime the form is loaded, how would I accomplish this?
0
8080_DiverCommented:
You might try putting it in the On Show event instead of in the On Click of the label.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

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.