Ivan,
I was able to trick the Xtra Report into allowing you to drop a BusBinding Source and Bus object onto it. first create a base class report that implements IContainer. I still need to figure a few things out to make it better but below is what I have so far and seems to work. The Preview won't work but you can bind all the fields etc. But to be honest i am wondering if I even wnat to use BO's for the reports as it seems like most reports i have are base on query's with joins. But here is what I did maybe it will be helpful
Public Class XtraReportBase
Implements MicroFour.StrataFrame.UI.Windows.Forms.IContainerControl 'Add This Line
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.End SubPublic Sub AddBusinessObject(ByVal BusinessObject As MicroFour.StrataFrame.Business.BusinessLayerBase) Implements MicroFour.StrataFrame.UI.Windows.Forms.IContainerControl.AddBusinessObject
End Sub
Public Sub AddObjectToInitOnLoad(ByVal ObjectToInit As MicroFour.StrataFrame.UI.IInitOnFormLoad) Implements MicroFour.StrataFrame.UI.Windows.Forms.IContainerControl.AddObjectToInitOnLoadEnd SubPublic Sub AddObjectToPreInitOnLoad(ByVal ObjectToPreInit As MicroFour.StrataFrame.UI.IPreInitOnFormLoad) Implements MicroFour.StrataFrame.UI.Windows.Forms.IContainerControl.AddObjectToPreInitOnLoadEnd SubPublic Sub RemoveBusinessObject(ByVal BusinessObject As MicroFour.StrataFrame.Business.BusinessLayerBase) Implements MicroFour.StrataFrame.UI.Windows.Forms.IContainerControl.RemoveBusinessObjectEnd SubEnd
ClassNow go into the designer.vb file of the base report and change
Friend WithEvents Detail As DevExpress.XtraReports.UI.DetailBandFriend WithEvents PageHeader As DevExpress.XtraReports.UI.PageHeaderBandFriend WithEvents PageFooter As DevExpress.XtraReports.UI.PageFooterBandto
Protected WithEvents Detail As DevExpress.XtraReports.UI.DetailBandProtected WithEvents PageHeader As DevExpress.XtraReports.UI.PageHeaderBandProtected WithEvents PageFooter As DevExpress.XtraReports.UI.PageFooterBand
Next create a new class that looks like below
Public Class InheritedReport
Inherits ReportBase.XtraReportBase ' The base class from above
Public Sub New()InitializeComponent()
End SubPrivate Sub InitializeComponent()End SubEnd
ClassRebuild and you should be able to get into the designer of your new subclassd report
Drop a business binding source and bus object on the form set the data source of the report to be the business binding source. The type editor of the business binding source will not work so you need to set it manually in the init component. Maybe this can figured out
Public
Class InheritedReportInherits ReportBase.XtraReportBaseFriend WithEvents XrLabel1 As DevExpress.XtraReports.UI.XRLabelFriend WithEvents BusinessBindingSource1 As MicroFour.StrataFrame.Business.BusinessBindingSourceFriend WithEvents BusinessObject11 As TEstBO.BusinessObject1Private components As System.ComponentModel.IContainerPublic Sub New(Lcname as String)InitializeComponent()
I also added the fill method here ? works
Me.BusinessObject11.FillByName(LcName)End Sub
Private Sub InitializeComponent()Me.components = New System.ComponentModel.ContainerMe.XrLabel1 = New DevExpress.XtraReports.UI.XRLabelMe.BusinessBindingSource1 = New MicroFour.StrataFrame.Business.BusinessBindingSource(Me.components)Me.BusinessObject11 = New TEstBO.BusinessObject1(Me.components)CType(Me, System.ComponentModel.ISupportInitialize).BeginInit()''Detail'Me.Detail.Controls.AddRange(New DevExpress.XtraReports.UI.XRControl() {Me.XrLabel1})''XrLabel1'Me.XrLabel1.Location = New System.Drawing.Point(33, 8)Me.XrLabel1.Name = "XrLabel1"Me.XrLabel1.Padding = New DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100.0!)Me.XrLabel1.Size = New System.Drawing.Size(100, 25)Me.XrLabel1.Text = "XrLabel1"''BusinessBindingSource1'Me.BusinessBindingSource1.ParentForm = Nothing'Manually add Line BelowMe.BusinessBindingSource1.BusinessObject = Me.BusinessObject11''BusinessObject11'Me.BusinessObject11.ParentContainer = MeMe.BusinessObject11.SynchronizingObject = NothingCType(Me, System.ComponentModel.ISupportInitialize).EndInit()End SubEnd
Class
Now to call the report...
Dim rpt As New TestAppReports.InheritedReport("TEST")rpt.ShowPreview()