Best place (event) to put BO data access code to fill 3rd party control?


Author
Message
William Fields
William Fields
StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)
Group: StrataFrame Users
Posts: 80, Visits: 239
Hello,

Working on my first SF Maintenance Form and have a couple BO's that are retrieving data just fine.

Now, I need to take the data contained within the BO's and load it into a 3rd party calendar control. Basically, I have to cycle through the data tables and create an object the calendar control can use for each data row. I'd love to be able to bind the calendar control directly to the BO's, but I'm not sure that's possible. All the sample code from the calendar vendor shows methods that take data and push it into collections of "appointment" objects, which the control then uses for it's data.

Also, since this is my first sample SF app, I'm trying to take the path of least resistance. So I'm just going with the vendor's examples for now.

BTW - the calendar control is the dbiMonth control from DBI Technologies. http://www.dbi-tech.com/

So, my question is, "What event should I use to load the data into the calendar control?"

I'm still a .NET WinForms newbie, but in VFP I would do this in the INIT event of the form since all the form controls would be available, but the form would not be visible yet. I have a working example of loading the data into the calendar control in the click of a button on the form, but I woud like to load the data before the form becomes visible.

Suggestions?

Thanks.

Bill
Replies
William Fields
William Fields
StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)StrataFrame User (328 reputation)
Group: StrataFrame Users
Posts: 80, Visits: 239
Thanks Edhy, you gave me a few helpful tips.

First, I imagine the call to MyBase.OnLoad(e) is what would cause the ParentFormLoading event to fire, which means the BO's would have all thier data at that point, correct?

Second, I'm very interested in the multithreading capabilities in SF. You're example is right on target and I will be able to incorporate it into my sample app.

Thanks.

Bill
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
You are welcome William!

William Fields (4/11/2011)
First, I imagine the call to MyBase.OnLoad(e) is what would cause the ParentFormLoading event to fire, which means the BO's would have all thier data at that point, correct?

Yes and no.  You are responsible for loading the data into the BO, for that you can use whatever event you prefer that will suit your application's needs.  In my case, I prefer to always have a custom method responsible for loading the data, in this form, I created the LoadAllDataForScheduler() which will simply do just that, fill the BOs needed by the form with the correct data so I can use them later.  In this particular case, I do that in the DoWork event of the background worker object (see .Net help or Google for more info).  Again, this is the way I have found the correct timing to work so it will show the form to the user and then a wait window letting then know that the data is being loaded.  I am sure there are other ways to do the same, and probably easier.


    Private Sub bwMainData_DoWork(sender As System.Object, e As System.ComponentModel.DoWorkEventArgsHandles bwMainData.DoWork
         Me.LoadAllDataForScheduler(MeNew EventArgs)
    End Sub


William Fields (4/11/2011)
Second, I'm very interested in the multithreading capabilities in SF. You're example is right on target and I will be able to incorporate it into my sample app.

Yes, Background workers are very easy to use without all the complications of having to handle all the multithreading complexities of the past.  VS 2010 added a lot of functionality for more complex operation like Task, but in this case a simple Background Worker will do the trick easier.

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search