Article View: borland.public.cppbuilder.nativeapi
Article #12288Re: Error!
From: Remy Lebeau (TeamB)
Date: Sun, 14 Dec 2003 22:00
Date: Sun, 14 Dec 2003 22:00
27 lines
1823 bytes
1823 bytes
And the *actual* problem is ...? Your subject is not descriptive at all,
and you only posted code but not a single word as to explain what is wrong
with it. If you do not provide details, nobody can help you.
I suspect you are trying to refer to the following line of code:
AnsiString Number = TDBEdit(Compon)->Text;
That is not a correct way to cast a pointer in C++. That looks like you are
trying to adapt Delphi code to C++. The correct code should look like this
instead:
AnsiString Number = static_cast<TDBEdit*>(Compon)->Text;
That is assuming, of course, that FindComponent() actually found a TDBEdit
in the first place, otherwise the code will have undefined behavior. If you
are not 100% certain that FindComponent() will actually return a TDBEdit,
then use dynamic_cast instead:
TDBEdit *dbe = dynamic_cast<TDBEdit*>(Compon);
if( dbe )
{
//...
}
Gambit
Technical Details
Message-ID:
<3fdcdc4d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!skynet.be!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3fdc4d48@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,8dcda86942d6f27f X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-12-14 14:08:42 PST From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3fdc4d48@newsgroups.borland.com> Subject: Re: Error! Date: Sun, 14 Dec 2003 14:00:05 -0800 Lines: 29 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 67.23.78.224 Message-ID: <3fdcdc4d$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1071438925 67.23.78.224 (14 Dec 2003 13:55:25 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!skynet.be!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail