Problem with type that causes error "Expected ':' but '=' found.

Hi all I do not understand what's wrong with type keyword 
This is a completed code for testing only.
And the error says 'error "Expected ':' but '=' found.'
What could it be? 

{code}
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm1 = class(TForm)
  TTemp = (Hot, Warm, Cold);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

end.
{code}

Clement
0
Yap
8/15/2011 9:57:55 AM
embarcadero.delphi.general 4258 articles. 0 followers. Follow

4 Replies
1190 Views

Similar Articles

[PageSpeed] 24

Yap Tsi Searn wrote:

> Hi all I do not understand what's wrong with type keyword 
> This is a completed code for testing only.
> And the error says 'error "Expected ':' but '=' found.'
> What could it be? 
> 
> {code}
> unit Unit1;
> 
> interface
> 
> uses
>   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
> Forms,   Dialogs;
> 
> type
>   TForm1 = class(TForm)
>   TTemp = (Hot, Warm, Cold);
>   private
>     { Private declarations }
>   public
>     { Public declarations }
>   end;
> 
> var
>   Form1: TForm1;
> 
> implementation
> 
> {$R *.dfm}
> 
> end.
> {code}
> 
> Clement

You have inserted the TTemp in the wrong place it should be located
before the TForm definition:

{code}
....
type
   TTemp = (Hot, Warm, Cold);
   TForm1 = class(TForm)
   private
.....
{code}
-- 

Lajos Juhász
0
Lajos
8/15/2011 10:07:16 AM
> {quote:title=Yap Tsi Searn wrote:}{quote}
> Hi all I do not understand what's wrong with type keyword 
> This is a completed code for testing only.
> And the error says 'error "Expected ':' but '=' found.'
> What could it be? 
> 
> {code}
> unit Unit1;
> 
> interface
> 
> uses
>   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
>   Dialogs;
> 
> type
>   TForm1 = class(TForm)
>   TTemp = (Hot, Warm, Cold);
>   private
>     { Private declarations }
>   public
>     { Public declarations }
>   end;
> {code}

You have put TTemp declaration in the wrong place. It should be

{code}
 type
   TTemp = (Hot, Warm, Cold);

   TForm1 = class(TForm)
   private
     { Private declarations }
   public
     { Public declarations }
   end;
{code}

or if you want TTemp to be encapsulated in TForm class

{code}
 type
   TForm1 = class(TForm)
   private type
      TTemp = (Hot, Warm, Cold);
   public
     { Public declarations }
   end;
{code}

Dalija Prasnikar

Edited by: Dalija Prasnikar on Aug 15, 2011 3:07 AM
0
Dalija
8/15/2011 10:08:06 AM
Hi Lajos and Dalija
Thanks for pointing out my mistake.

Btw. Dalija,
 The second solution does not work

Anyway 
thanks 

Clement
0
Yap
8/16/2011 1:33:47 AM
On 8/15/2011 8:33 PM, Yap Tsi Searn wrote:
> Hi Lajos and Dalija
> Thanks for pointing out my mistake.
>
> Btw. Dalija,
>   The second solution does not work
>

That all depends on what version of Delphi you are using. It always 
helps to specify your Delphi version in your question, otherwise people 
tend to assume the latest version.
0
Dave
8/16/2011 3:35:05 AM
Reply:

Similar Artilces:

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

Cast from type ''''DBNull'''' to type ''''String'''' is not valid.
How do I avoid getting this error: Cast from type ''''DBNull'''' to type ''''String'''' is not valid. I am trying to get values from the database into a form for updating using a Datareader, SQL is set to allow nulls for certain fields as they are not required but the only way I can get the form to display is by adding a space in SQL. Is there another way around this? Check if it is equal to DBNull.Value first and if it is, don't do the cast.Stanley Tan theSpoke Blog Where in the code does it need to go? I am using the following and it's the profile that isn't always requi...

table_info('','','','%') cannot return any types
I was recently confirming table_info special cases and discovered the case for getting table_types cannot work. table_info('','','','%') should return a list of table types but it returns a list of empty strings instead: my @types = $h->tables('', '', '', '%'); print "all types:\n", join("xxx\n", @types), "\n"; # should output something like: # "dbo" # "INFORMATION_SCHEMA" # "sys" # and actually outputs: xxx xxx It seems to be down to the following ...

'100' is an unexpected token. The expected token is '"' or '''.
Dear all,  I have a web form which will call a report viewer and show the report. The report works fine under report server. When call from aspx, it show the below error. Do you know WHY? '100' is an unexpected token. The expected token is '"' or '''. Line 20, position 77. hi rchiu5hk, select rdl/rdlc file in .net IDE and right click then open with xml editor option and then copy the content and then paste it here. so that it may give some better idea on the issue."Mark as Answer" -- on the post that helps youRKChaudary I think ...

Error "denotes a 'property' where a 'class' was expected"
Hi! All I want to do ist making the Reponse Object running im my Class. Here the Code: public class Mywriter { public Mywriter() { } public void mywrite(string text) { Response.Write(text); } } void page_load(Object sender, EventArgs e) { Mywriter mytester = new Mywriter(); mytester.mywrite("test"); } When i run the Code, i get the following error: Compiler Error Message: CS0118: 'System.Web.UI.Page.Response' denotes a 'property' where a 'class' was expected ( @ "mytester.mywrite("test"); ) ...

"Client found response content type of '', but expected 'text/xml'.
When i call a secure webservice from a asp.net page that uses x509 certificate for securing the webservice this is the error i get "Cryptography_CSP_NoPrivateKey". Well i had .Net Frame work 1.0 and i was using WSE2.0 for securing the webservice. So I upgraded it to .Net Framework 1.1 and now i dont get that error anymore. I am really not sure if this is what fixed my problem . However the bad news is now none of my webservices are working. Even the simple webservice and webservice secured by x509 certificate return the following error --- "Client found resp...

'do' won't 'do' if '/'
Greetings to All from Au, Have a NetWare Perl 5.8.4 and wanted to tweak File\Spec\NW.pm to try and standardise on '/' separators. If I run a test script (t/uni/lower.t) with an unmodified NW.pm, it calls t/uni/case.pl, that, in case.pl, (when the path separators are '\'), the $file is '..\lib\unicore\To\Lower.pl' and the following code portion works, with $simple getting a returned table: sub casetest { my ($base, $spec, $func) = @_; my $file = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "lib", &qu...

'''
Name: L Lachowsky Email: e2brutus_10atyahoodotcom Product: Firefox Summary: ''' Comments: why duddn this surprise me... I change default server from IE to Mozilla, and then i get error messages. well, shud I decide to not get on my computer with Mozilla..or shud I risk security breeches with IE....hmmm at least i can get on the internet with IE Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this fee...

error in ''%'' operator
hi... friends    i got this error (Syntax error: Missing operand after ''%'' operator)below statement. dtBtnScr.DefaultView.RowFilter = "LOCATION_CITY'" + txtCity.Text.Trim() + "%'AND LOCATION_STATE '" + ddlState.SelectedValue + "%'AND UNIT_ID'" + txtUnitCode + "%'AND UNIT_NAME '" + txtUnitName.Text.Trim() + "%'";   thnax friends It thinks you are trying to use the modulo operator: %. Look at the RowFilter string after you build it ...you should see the prob...

Cannot convert type 'type' to 'type'
I am learning all of this, so I am still fresh, so please bear with me :)I have a page that has some txtboxes in it, simple registration form, and I have a button that will save those txt boxes to the db. I am using:- I am using Visual Web Developer 2008 Express Edition- C# When I try to compile the project I get error: Cannot convert type 'System.Web.UI.WebControls' to 'String' This is content of my web.config    <profile> <properties> <add name="FirstName"/> <add name="LasttName"/>...

Invocation Error
This is my first foray into consuming webservices... Basically, I want to use a webservice to do UPC code lookups. I used the sample webservices as a blueprint. I attached a document with whatever documenation I could think of. Any help would be appreciated. Thanks, Kevin begin 666 upclookup.doc MT,\1X*&Q&N$`````````````````````/@`#`/[_"0`&```````````````" M````A0``````````$ ``AP````$```#^____`````(,```"$````________ M____________________________________________________________ M____________________________________________________________ M...

Operator '*' is not defined for type 'DBNull' and type 'Decimal'.
 I am getting an error from the following line   <asp:Label ID="Label1" runat="server" Text='<%# String.Format("{0:C}", Eval("ProductQty") * Eval("Price"))   %>' ></asp:Label> I think I may need to convert/define the Variables but not quite sure how to do it. Any help would be great. it's not a matter of converting...its the fact that the value from the DB is Null... You'll have to wrap an IF check around it or change your query to return 0 instead of Null. If the field ...

Operator '=' is not defined for type 'Char' and type 'Boolean'.
Hello, In my application when i click the button i'm getting this " Operator '=' is not defined for type 'Char' and type 'Boolean'. " But when i test it locally there is no problem at all!!!! Please tell me why this error is occuring...Thanks SwapnaPlease click "mark as answer" if this post helped you. swapnasamsonvarkey: Hello, In my application when i click the button i'm getting this " Operator '=' is not defined for type 'Char' and type 'Boolean'. " But when i test it lo...

Web resources about - Problem with type that causes error "Expected ':' but '=' found. - embarcadero.delphi.general

Resources last updated: 12/17/2015 8:17:15 AM