Populating BO from Class that implements IListSource


Author
Message
Peter Denton
Peter Denton
StrataFrame Novice (111 reputation)StrataFrame Novice (111 reputation)StrataFrame Novice (111 reputation)StrataFrame Novice (111 reputation)StrataFrame Novice (111 reputation)StrataFrame Novice (111 reputation)StrataFrame Novice (111 reputation)StrataFrame Novice (111 reputation)StrataFrame Novice (111 reputation)
Group: Forum Members
Posts: 77, Visits: 787
G'day

I'm trying to populate some list boxes from a Class that Implements IListSource. I know that populating a listbox from a BO is easy. I also know that a BO can be populated from an enum. Something like

Private Sub DeviceTypeEnumBO_ParentFormLoading() Handles Me.ParentFormLoading

    Dim dt as New Data.DataTable

    dt = StrataFrame.Tools.Common.BuildTableFromEnum(GetType(DeviceType))

    Me.CopyDataFrom(dt, StrataFrame.Business.BusinessCloneType.ClearAndFillFromCompleteTable)

    dt.Dispose()

End Sub

I'm wondering if there is s similar technique for populating a BO from a IListSource Class. I'm sure there is a means of populating the listbox directly through some means, but for consistency I'd like to use a BO in every case if possible.

Any hints would be greatly appreciated

Peter

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
We don't have a method for populating a combo box from an IListSource.  However, that functionality already exists within .NET.  In order to use the functionality, you set your IListSource object as the .DataSource property on a combo (or ListBox or any other control that inherits from System.Windows.Forms.ListControl).  Then, you set the .DisplayMember to the name of the property or column on the object that should be the display and set the .ValueMember to the column or property on the data source that should be the value of each object within the list.

In fact, this is what we do behind the scenes, even with the enum... we just build a DataTable (which implements IListSource) and set the DisplayMember and ValueMember properties after setting the DataSource.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I'm wondering if there is s similar technique for populating a BO from a IListSource Class.

No.  The population methods on our List controls (combos, lists, ListView) all take the same approach and are designed to work within the integrity of a Business Object (or enum in the case of a combo).  Population through an enum or BO when using the SF list controls should suffice most any population needs.  We have never seen a need outside of these methods.

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