Board index » cppbuilder » Ambiguity between AnsiString(char)and AnsiString(short)

Ambiguity between AnsiString(char)and AnsiString(short)

Hi to All!
I wrote some code and became this error message.
with StrToInt(....) it works.
but with StrToFloat not.
Why and what  I must change.

//---------------------------------------------------------------------------

void __fastcall TTimesheet1::StringGrid1SetEditText(TObject *Sender,
      int ACol, int ARow, const AnsiString Value)
{
int s,z;
for(s=3;s<=13;s++)
for(z=1;z<=32;z++)
{
StringGrid1->Cells[s][32]='0,00';

Quote
}

//}
for(s=3;s<=13;s++)
for(z=1;z<=31;z++)
{
 if(StringGrid1->Cells[s][z]>"")

StringGrid1->Cells[s][32]=StrToFloat(StringGrid1->Cells[s][32])+StrToFloat(StringGrid1->Cells[s][z]);

Quote
}

[C++Fehler] Unit7.cpp(82): Ambiguity between '_fastcall
System::AnsiString::AnsiString(char)' and '_fastcall
System::AnsiString::AnsiString(short)'.

Thanks a lot.

Greetings Philipp

 

Re:Ambiguity between AnsiString(char)and AnsiString(short)


Here is a good explanation (you may have to re-assemble the long
link.)
http://www.mers.com/MERLIST/BORLAND/PUBLIC/CPPBUILDER/VCL/42761.HTML
The solution is to use .ToDouble.  Make sure your Locale information
(i.e. the Decimal Separator) is set for your home country-in this
case, comma.

If you search in Help for "AnsiString,AnsiString", you will see a list
of all possible constructors for AnsiStrings.  Unfortunately, the
return value of StrToFloat is not an acceptable argument type.  Double
*is*.
-------
Timothy H. Buchman
========================================
City Center Theater, New York NY

mailto:tbuch...@citycenter.org

Please treat this signature information as confidential.
========================================

Quote
Philipp Pauleit <P.Paul...@t-online.de> wrote in message

news:3848307A.DB66D7A9@t-online.de...
Quote
> Hi to All!
> I wrote some code and became this error message.
> with StrToInt(....) it works.
> but with StrToFloat not.
> Why and what  I must change.

file://---------------------------------------------------------------
------------
Quote

> void __fastcall TTimesheet1::StringGrid1SetEditText(TObject *Sender,
>       int ACol, int ARow, const AnsiString Value)
> {
> int s,z;
> for(s=3;s<=13;s++)
> for(z=1;z<=32;z++)
> {
> StringGrid1->Cells[s][32]='0,00';
> }

> file://}
> for(s=3;s<=13;s++)
> for(z=1;z<=31;z++)
> {
>  if(StringGrid1->Cells[s][z]>"")

StringGrid1->Cells[s][32]=StrToFloat(StringGrid1->Cells[s][32])+StrToF
loat(StringGrid1->Cells[s][z]);

- Show quoted text -

Quote

> }

> [C++Fehler] Unit7.cpp(82): Ambiguity between '_fastcall
> System::AnsiString::AnsiString(char)' and '_fastcall
> System::AnsiString::AnsiString(short)'.

> Thanks a lot.

> Greetings Philipp

Other Threads