My BussinessObject does not exist in the current context
Tale Masinov
Skopje, Macedonia
Hi... [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
I'm using FastReport.NET. I am creating a report all from code and I have the following error.
My data source is a bussiness object, actually a list of objects, that are in another .dll which I'm referencing in my project.
Example:[/img]
If the class definition is in the same namespace with the report it works fine, but in my case it throws me the error
"The name 'Test' does not exist in the current context"
The definition of the class Test is in another project, and I'm adding a reference to it in my FastReport project.
Can someone help ?
Thanks.
public class Test
{
public string TestField1
{ get; set; }
}
List<Test> testList = new List<Test>();
If the class definition is in the same namespace with the report it works fine, but in my case it throws me the error
"The name 'Test' does not exist in the current context"
The definition of the class Test is in another project, and I'm adding a reference to it in my FastReport project.
Can someone help ?
Thanks.
Comments
report.Prepare() throws the error "The name 'Test' does not exist in the current context"
Did you register the data source in a report using the report.RegisterData call? Please look at the demos to see how to do this:
Demos\C#\DataFromBusinessObject
Demos\C#\Main
Yes I did that... but.... [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> Here is my class hierarchy : I have a base class (for example Base) with some public properties. I inherit from Base class into class Derived in which I have other public properties. My Data Source is a List<Derived> generic list, which I register and I still get the same error. But if Derived does not inherit from Base it works properly. The code example I gave earlier explains it.[/img]
FastReport interprets differently between IEnumerable types. I used generic list of objects ( List<T> ).
I tried it with ArrayList and it works.
Thanks anyway
The problem is that you are using List<TestClass>, which contains TestClass2 instances. Either use List<TestClass2>, or ArrayList.