Problems Moving Crystal Reports LineObject Dynamically

cymdiaz

New member
Joined
Feb 18, 2006
Messages
2
I would like to dynamically change the coordinates on a lineobject in my Crystal Report (Visual Studio 2005, C#, Crystal bundled version 10).

All the documentation and information I can find leads me to the LineObject properties Top, Bottom, Left and Right. They have set and get enabled, but there is a catch to their use which I havent been able to figure out.

Crystal supports only vertical or Horizontal lines. During design time, the designer, automatically changes the corresponding property value to keep the line object either vertical or horizontal.

In a Horizontal line, left and right should be equal, and in a vertical line top and bottom should be equal. I cannot find a method where I can change both simultaneously and if I try to change one in one line of code, then the other in the next line of code, the first line generates a System.Runtime.InterOpServices.COMException with the added caveat that it didnt change the property value (otherwise I would nest catch- try blocks).

I tried looking for a method where I could construct a line then add the line to the report, or set the existing line equal to the newly constructed line, but I cannot find a constructor method for the lineobject.
 
hi,

I think the following code can solve your problem.
Attention about section you have to specify your correct section name and also your line name.

myReport _myReport = new myReport ();
myReport .Section1.ReportObjects["myline"].Top = 10;

rgds,
Tiago Teixeira
 
Back
Top