Here's a thought ...

What type is the index to the Field property? Integer? byte? (sorry, I don't
have D up right now)
What type does Ord() return? Cardinal?
What type is intBankNo? Integer maybe?
I would have thought any type conversion between these sort of types was
implicit but maybe there's a catch in it somewhere which is resolved by forcing
the type conversion with the assignment?

Cheers
Pedrocelli

----- Original Message -----
From: "James Sugrue" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Friday, January 10, 2003 9:04 AM
Subject: Re: [DUG]: Porting to Delphi 6


Maybe it has something to do with the way it was calculating
"Field[Ord(bkBankNo) + 1]"

What happens if you try :

Field[(Ord(bkBankNo) + 1)]


Otherwise, I got nuttin....


----- Original Message -----
From: Matt Dee <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Sent: Thursday, January 09, 2003 5:41 PM
Subject: [DUG]: Porting to Delphi 6


> I'm in the middle of porting our main app to Delphi 6 and I came across
this probem.
>
> in Delphi 4, the following ran ok:
>
> if dbgrdBankAccounts.Field[Ord(bkBankNo) + 1].AsString =
Company.sDefaultBankAccount then
>
>
>
> Under Delphi 6 I get an access violation.  However, if I break it down
into its component
> pieces, everything runs as it used to:
>
>   intBankNo := Ord(bkBankNo) + 1;
>   strBankAcc := dbgrdBankAccounts.Field[intBankNo].AsString;
>   if strBankAcc = Company.sDefaultBankAccount then //we're ok......
>
>
> Any ideas why this would happen?  It's not a huge issue, but it does
indicate a possible
> problem with the compiler unless I'm missing something obvious here.
>
> (This isn't my code BTW, I'm maintaining it *cries*)

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to