﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » BindingSource on XtraReport</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Wed, 10 Jun 2026 20:36:21 GMT</lastBuildDate><ttl>20</ttl><item><title>BindingSource on XtraReport</title><link>http://forum.strataframe.net/FindPost4449.aspx</link><description>I'm trying to use a BusinessBindingSource as suggested for binding a BO to an XtraReport object as a DataSource.&amp;nbsp; A couple of issues that I've come across and haven't been able to get figured out yet...&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; How would you ever be able to preview the report this way?&amp;nbsp; The BO has no data connection at design time, so it doesn't know where to get the data.&amp;nbsp; Is there some way this feature can be added...something like a design-time data source we can point it to?&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;The XtraReport does not support dropping the BO onto the designer.&amp;nbsp; I used some code and mangled the report enough to force it to allow me to drop one onto the designer.&amp;nbsp; However, it still won't let me set the BusinessObject property of the BindingSource at design time.&amp;nbsp; I get the error: "Unable to cast object of type 'WindowsApplication1.XtraReportBase' to type 'System.Windows.Forms.Control'."&lt;/P&gt;&lt;P&gt;Am I going about this the wrong way?&amp;nbsp; Would it be better not to use a BO/BindingSource for the data source on an XtraReport?&amp;nbsp; &lt;/P&gt;&lt;P&gt;The only way I can currently get anything to work is setting everything at run-time and that just isn't going to work for the really complicated reports.&amp;nbsp; I need to be able to set things at design-time and preview the output.</description><pubDate>Wed, 15 Nov 2006 14:50:06 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: BindingSource on XtraReport</title><link>http://forum.strataframe.net/FindPost4540.aspx</link><description>Is there no way to get a Fill method on a BO to execute correctly at design time?&amp;nbsp; It seems like there has to be some way of doing this.&amp;nbsp; It executes the InitializeComponent sub at design time so I stuck some things in there and got everything including preview to work.&amp;nbsp; However, I still don't get data in my preview because the Fill won't run at design time.&amp;nbsp; Any way at all to get a BO with data in it at design time??</description><pubDate>Wed, 15 Nov 2006 14:50:06 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: BindingSource on XtraReport</title><link>http://forum.strataframe.net/FindPost4479.aspx</link><description>Andria,&lt;/P&gt;&lt;P&gt;I went through the same issue's. I am pretty sure Dev express only supports design time preview when you use a data adapter etc. I would think there would be an event that you could hook into to populate an objects datasource at design time but&amp;nbsp;I never found it. I looked around on the forums there and could not find out how to get design time preview to work with an object.&lt;/P&gt;&lt;P&gt;I think that using a business object for a report is a good idea in principle but it gets screwy when you have complex reports with multi tables as&amp;nbsp;business object's really represent a single table. That being said I created my own set of "QueryObjects" that represent the fields returned from a query. Kind of like a read only chopped down version of a business object.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I bind this object to the report to get design time binding of the fields (like I said I am unable to get design time preview to work). I&amp;nbsp;also have additional properties on the query object&amp;nbsp;that store the select statement and parameters&amp;nbsp;as well as&amp;nbsp;additional report meta data. I also have methods to retrieve the data using strataframes data access layer. like below&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/FONT&gt;&lt;FONT size=2&gt; QueryDataSource() &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Implements&lt;/FONT&gt;&lt;FONT size=2&gt; Report.iReportQueryProvider.QueryDataSource&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.DataSource = MicroFour.StrataFrame.Data.DataBasics.DataSources(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;""&lt;/FONT&gt;&lt;FONT size=2&gt;).GetDataTable(BuildSqlCommand, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Nothing&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Function&lt;/FONT&gt;&lt;FONT size=2&gt; BuildSqlCommand() &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; SqlClient.SqlCommand&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;FONT size=2&gt; LoSqlCmd &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;FONT size=2&gt; SqlClient.SqlCommand&lt;/P&gt;&lt;P&gt;LoSqlCmd.CommandText = oMetaDataBiz.SQL&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;'Build Parameters Collection&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;For&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Each&lt;/FONT&gt;&lt;FONT size=2&gt; p &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; ReportParameter &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;In&lt;/FONT&gt;&lt;FONT size=2&gt; oMetaDataBiz.ParametersCollection&lt;/P&gt;&lt;P&gt;LoSqlCmd.Parameters.AddWithValue(p.ParameterName, p.ParameterValue)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Next&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Return&lt;/FONT&gt;&lt;FONT size=2&gt; LoSqlCmd&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Function&lt;/P&gt;&lt;/FONT&gt;&lt;P&gt;However the more direct approach is to just create a report using the dev express data adapter etc. This gives you preview at design time. Then at runtime just swap the datasource with a table from a biz obj.&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;Hope this helps a bit.&lt;/P&gt;&lt;P&gt;Paul</description><pubDate>Wed, 15 Nov 2006 09:02:00 GMT</pubDate><dc:creator>Paul Chase</dc:creator></item></channel></rss>