🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #12225

Re: Error!

#12225
From: Safari
Date: Tue, 16 Dec 2003 09:18
35 lines
2021 bytes
Thanks Remy,
Safari

"Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> wrote in message
news:3fdcdc4d$1@newsgroups.borland.com...
| 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: <3fdf87ce@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3fdc4d48@newsgroups.borland.com> <3fdcdc4d$1@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-16 14:40:08 PST
From: "Safari" <Safari@alloymail.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3fdc4d48@newsgroups.borland.com> <3fdcdc4d$1@newsgroups.borland.com>
Subject: Re: Error!
Date: Tue, 16 Dec 2003 12:48:04 +0330
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 194.225.63.168
Message-ID: <3fdf87ce@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1071613902 194.225.63.168 (16 Dec 2003 14:31:42 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail