Page 1 of 1

Bind BindingList

Posted: Sat Feb 21, 2009 5:12 am
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 ?

Bind BindingList

Posted: Sat Feb 21, 2009 3:34 pm
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

Bind BindingList

Posted: Tue Feb 24, 2009 6:49 am
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 ?

Bind BindingList

Posted: Wed Feb 25, 2009 3:58 am
by Hussam
up

Bind BindingList

Posted: Wed Feb 25, 2009 5:21 am
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.

Bind BindingList

Posted: Thu Feb 26, 2009 9:35 am
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.