Bind BindingList

Stimulsoft Reports.NET discussion
Post Reply
Hussam
Posts: 3
Joined: Sat Feb 21, 2009 5:01 am

Bind BindingList

Post by Hussam »

Hello :
how can I bind a BindingList as DataSoure To The Report ?
I tried the following :

Code: Select all

 BindingList class1List = new BindingList() ;
            class1List.Add(new Class1(){ Id ="1" , Name ="test1" ,Type = new ClassType() { TypeName="type1"} }) ;
            class1List.Add(new Class1(){ Id ="2" , Name ="test2" ,Type = new ClassType() { TypeName="type1"} }) ;
            class1List.Add(new Class1(){ Id ="2" , Name ="test3" ,Type = new ClassType() { TypeName="type2"} }) ;
         
            stiReport1.RegData("class1" , class1List  );
            stiReport1.Show();
            stiReport1.Dictionary.Synchronize();
it throws the following Exception :

Code: Select all

c:\Documents and Settings\Hussam\Local Settings\Temp\ljixkzlx.0.cs(282,28) : error CS0246: The type or namespace name 'TestProject' could not be found (are you missing a using directive or an assembly reference?)
Any Help ?
s.meyer@bitworld.ch
Posts: 1
Joined: Sat Feb 21, 2009 3:31 pm
Location: Switzerland

Bind BindingList

Post by s.meyer@bitworld.ch »

You have to add the assembly to the reference list, where your Class1 is defined:

// Get the existing references defined in the report
string[] references = stiReport.ReferencedAssemblies;
// Converting the the array to a collection
List newReferences = references.ToList();
// Add your Assembly to the list
newReferences.Add("WindowsFormsApplication1");
// Reset the array of referenced assembly with the converted collection
report.ReferencedAssemblies = newReferences.ToArray();

Hope this helps

Severin
Hussam
Posts: 3
Joined: Sat Feb 21, 2009 5:01 am

Bind BindingList

Post by Hussam »

I tried but it shows the following exception

Code: Select all

c:\Documents and Settings\Hussam\Local Settings\Temp\2fnnqqzi.0.cs(72,47) : error CS1001: Identifier expected
any help ?
Hussam
Posts: 3
Joined: Sat Feb 21, 2009 5:01 am

Bind BindingList

Post by Hussam »

up
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Bind BindingList

Post by Edward »

Hi Hussam,

Also you can try to add your custom namespaces directly in the Designer.

Just select report object in the Property Editor and then add all references to ReferencedAssemblies property. Also please be sure that your assemblies have been placed in the same folder as our dlls.

If the issue is still there then please send the sample project to support[at]stimulsoft.com.

Thank you.
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Bind BindingList

Post by Jan »

Hello Hussam,

> I am trying stimulsoft reports to find out if it meets my company
> needs .. our programs depends on bindinglist as a data store ...
> so when I tried your product and passed a bindinglist to the report
> it showed an exception ....
> in the attachment you will see a sample project , I wish you can tell
> me what wrong ...

You need make two corrections in your report:

You have used following code in using section:

using Stimulsoft.Report.Dialogs;
using Stimulsoft.Report.Components;
using TestProject

Please set symbol ";" after "TestProject". Correct code is:

using Stimulsoft.Report.Dialogs;
using Stimulsoft.Report.Components;
using TestProject;

Second correction in text component DataClass1_Type_TypeName.

Expression {Class1.} is not correct. You need add column name.

Thank you.
Post Reply