Link to home
Start Free TrialLog in
Avatar of Freeday
Freeday

asked on

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.
Avatar of Superdave
Superdave
Flag of United States of America image

You don't have a procedure declaration at the start of the implementation section.
You don't need to declare them again in the var clause, there are in the form declaration already
ASKER CERTIFIED SOLUTION
Avatar of 8080_Diver
8080_Diver
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Freeday
Freeday

ASKER

Thank you, I want this code to execute everytime the form is loaded, how would I accomplish this?
You might try putting it in the On Show event instead of in the On Click of the label.