Recent

Author Topic: VarToStr raise RunError(201) exception  (Read 1431 times)

dmitryb

  • Jr. Member
  • **
  • Posts: 62
VarToStr raise RunError(201) exception
« on: June 05, 2018, 06:29:48 pm »
Hi All

Lazarus 1.8.4 r57972 FPC 3.0.4 i386-win32-win32/win64

When I call VarToStr in code of my project it raises RunError(201) exception.
I can't understand why
See screenshots
Variant value contains FMTBdcValue, but the "Watch List" does'n show the value.
So I can't create exact example for reproduction.


The code is the next:

Code: Pascal  [Select][+][-]
  1. procedure TDBGridEhNavigatorPanel.Test(var ResultArr: TAggrResultArr);
  2. var
  3.   s1, s2, s3: String;
  4.   v1, v2, v3: Variant;
  5. begin
  6.   v1 := ResultArr[agfSumEh];
  7.   v2 := ResultArr[agfCountEh];
  8.  
  9.   s1 := VarToStr(ResultArr[agfSumEh]);
  10.   s2 := VarToStr(ResultArr[agfCountEh]);
  11.  
  12.   v3 := v1 / v2;
  13.   s3 := VarToStr(v3); //RunError(201) exception
  14. end;  

value of ResultArr[agfSumEh] and ResultArr[agfCountEh] is visible on screenshots
but when I assign values manually the exception is not raised.
« Last Edit: June 05, 2018, 06:35:39 pm by dmitryb »

Thaddy

  • Hero Member
  • *****
  • Posts: 14377
  • Sensorship about opinions does not belong here.
Re: VarToStr raise RunError(201) exception
« Reply #1 on: June 05, 2018, 07:18:12 pm »
This is fixed in FPC trunk. Why do you re-ask?
Also, your code is not complete. There may be an issue elswhere. Make sure you provide a compilable example.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

dmitryb

  • Jr. Member
  • **
  • Posts: 62
Re: VarToStr raise RunError(201) exception
« Reply #2 on: June 05, 2018, 07:36:22 pm »
Yes, it is a duplicate of this message
http://forum.lazarus.freepascal.org/index.php/topic,41379.0.html
I wonder why I did not receive messages on the mail about activity in this thread.

I do not know how to use trunks for installation, so I'll wait for a new version of Lazarus.

This new thread can be deleted.

Thank you.
« Last Edit: June 05, 2018, 09:09:14 pm by dmitryb »

 

TinyPortal © 2005-2018