BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help with function StrToInt()

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder
View previous topic :: View next topic  
Author Message
ALAM
Guest





PostPosted: Mon Dec 04, 2006 6:31 pm    Post subject: Help with function StrToInt() Reply with quote



Hi All, I'm sorry becose I donīt speak correctly English. but I will
try to do.
I'm using the function StrToInt, this function throw an error
(EConvertError) when cannīt convert the string to integer. My problem
is: I don't catch the message throw for the function (EConvertError). I
don't understand.
Example:
try {
StrToInt(...../*any AnsiString*/)
}
Catch (EConvertError)
{
/* ............*/
}
Anybody can help me?
do you help me?
Back to top
mydog21
Guest





PostPosted: Wed Dec 06, 2006 6:45 am    Post subject: Re: Help with function StrToInt() Reply with quote



Hi.
StrToInt is very easy function.
but, is not compatible .



try this code.
---------------------------------

String strNumber = "1234";
int nNumber = strNumber.ToIntDef(-1);

if(nNumber == -1)
{
ShowMessage("Can not convert strNumber");
}
else
{
ShowMessage("Can convert! strNumber :" + String(nNumber));
}
Back to top
ALAM
Guest





PostPosted: Sun Dec 10, 2006 1:51 am    Post subject: Re: Help with function StrToInt() Reply with quote



Thanks mydog21, but I am using Builder C++, this program has included
tha function StrToInt. this function throw an error (EConvertError), my
problem is: I cann't catch the exception. Do you can help me?
Back to top
ALAM
Guest





PostPosted: Sun Dec 10, 2006 2:40 am    Post subject: Re: Help with function StrToInt() Reply with quote

Thanks mydog21, but I am using Builder C++, this program has included
tha function StrToInt. this function throw an error (EConvertError), my
problem is: I cann't catch the exception. Do you can help me?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.