Jump to content


Photo

[CellsByName] "Can't convert variant of (String) into (Boolean)"?


  • Please log in to reply
1 reply to this topic

#1 littlebigfred

littlebigfred
  • Members
  • 176 posts

Posted 08 September 2009 - 03:43 PM

Hello

I'm getting the following mysterious run-time error:

CODE
var
  cellcontent : WideString;
  index : Integer;
begin
  With Frame31.NextGrid1 do begin
      index := 0;
      cellcontent := Frame21.NextGrid1.Columns[index].Header.Caption;
      //OK ShowMessage(cellcontent);

      //Project Project1.exe raised exception
      //class EVariantTypeCastError with message
      //'Could not convert variant of type (String) into type (Boolean)'.

      CellsByName['parametre',index] := cellcontent;
     end;
end;


Since "cellcontent" is a WideString, and that both Columns[].Header.Caption and CellsByName use WideStrings, I don't understand where this error comes from. Any idea?

Thank you.

#2 littlebigfred

littlebigfred
  • Members
  • 176 posts

Posted 08 September 2009 - 03:51 PM

Oops, my mistake: I forgot that I renamed the columname from "key" to "parametre", and CellsByName could no longer find it. Sorry about that.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users