StrataFrame Forum

Help with Windows Controls

http://forum.strataframe.net/Topic1941.aspx

By Paul Chase - 7/25/2006

I am working in my "spare" time to create a reporting framework. I really like the way you have done the application framework and I am trying to emulate it. After burning up a few servers at google and bouncing around in the StrataFrame source code I have figured a few things out but still foggy on some things and was hoping you guys could help point me in the right direction.

Ok here is the question. I have subclassed a strataframe combobox (seemed like an easy control to start with) and added a property called ReportsLibrary to it which is a component class containing a collection of report objects.

Everything is good I can set the report library etc.. what i can't figure out is how to set the datasource in the custom control. If I set it on the forms load event everything does work as expected the report prints!! Hopefully you can point me in the right direction on how to set the datasource and member for with in the control as that is how it should be.

TIA

Paul

Here is the code

Imports System.ComponentModel

<TypeConverter(GetType(ReportLibraryTypeConverter))> _

Public Class RptComboBox

Inherits MicroFour.StrataFrame.UI.Windows.Forms.ComboBox

Private m_ReportLibrary As ReportEngine.ReportLibrary

<Category("ReportEngine"), _

DescriptionAttribute("Select the report library to bind to.")> _

Public Property ReportLibrary() As ReportEngine.ReportLibrary

Get

Return m_ReportLibrary

End Get

Set(ByVal Value As ReportEngine.ReportLibrary)

m_ReportLibrary = Value

End Set

End Property

Private Sub RptComboBox_SelectionChangeCommitted(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SelectionChangeCommitted

'Call the Print Options Method of the selected report

Me.ReportLibrary.ReportsCollection.Item(sender.selectedindex).ShowPrintOptions()

End Sub

Public Sub WhereCanIDoThis()

'This doesn't work because nothing is alive yet however if i call from form load everything is good how can I accomplish this

' Me.DataSource = Me.ReportLibrary.ReportsCollection

' Me.DisplayMember = "ReportName"

End Sub

End Class

  

By Trent L. Taylor - 7/26/2006

I depends on the parent container that is housing the objects.  One thing you may look at is the ParentFormLoading event on a combo box or business object.  I assume that it is a timing issue you are running into, correct?  You mentioned that when you populate in the load it works.  So are you asking how to make the combo automatically populate in the Load or just trying to determine the best place to populate a combo box?

Just FYI, a combo box is a little more complicated since it has the ability to populate automatically based on the properties.  The simplest control there is would be a TextBox.

By Paul Chase - 7/26/2006

Hi Trent,

I will look into the ParentFormLoading event as soon as I get home. This is sort of an after hours spare time project due to workload of critical projects. One of which has lots of reports which made me really miss the Reporting Classes I created in VFP so figured why not try to do something about it and learn more aobut .Net.

Basically what I am trying to accomplish is something like this.

Drop a Report Library component from toolbox on to form, Set property on report library to load appropriate reports.dll.

Drop combo onto form set Report Library property to the reportlibrary I just added. Run form and see list of reports in combo box without having to write code in the form load event. Kind of like a Bus object of reports.

hope that makes sense.

Thanks alot

Paul 

By Trent L. Taylor - 7/26/2006

It does.  Then you will probably benefit from the ParentFormLoading event.  This will probably give you what you need.  Let me know if you have any other questions.
By Paul Chase - 7/26/2006

Thanks alot Trent

Paul

By Trent L. Taylor - 7/26/2006

No Problem. Wink
By Daniel Essin - 7/29/2006

Another suggestion. I use Crystal. The attached form has a crystal 11.5 viewer on it. It points to a dir on a shared drive where all the reports are stored (although the could be in a dll if they are static).



Each report runs off an SP that has a parameter for each user selection criteria. When a report is selected, the app reads the parameters and creates a control on the form to collect the value. Clicking run the applies the criteria and the rpt displays.



Not being an FP type I don't if this would be of any use to you.



Smile

Dan
By Paul Chase - 8/24/2006

Thanks Daniel,

I am doing things a bit different.Smile

Paul

By Trent L. Taylor - 8/24/2006

Paul,

I was just going to tell you that you can use the BusinessBindingSource to make things a little easier as it related to wrapping a BO in a report.  This will give you all of the strong-typed fields for each row within the report and may keep you from having to tie directly to the CurrentDataTable.  There are other ways as well, I just though I would throw this out there. Smile