| View previous topic :: View next topic |
| Author |
Message |
ALAM Guest
|
Posted: Mon Dec 04, 2006 6:31 pm Post subject: Help with function StrToInt() |
|
|
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
|
Posted: Wed Dec 06, 2006 6:45 am Post subject: Re: Help with function StrToInt() |
|
|
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
|
Posted: Sun Dec 10, 2006 1:51 am Post subject: Re: Help with function StrToInt() |
|
|
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
|
Posted: Sun Dec 10, 2006 2:40 am Post subject: Re: Help with function StrToInt() |
|
|
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 |
|
 |
|