I need a little help in understanding a what is probably a very basic and easy concept. Everything in .Net is an object, seems like every control from a listbox to a grid, is based on some object be used with .Add() that is assoicated to some collection or another. In all the examples it appears as
1) create an "item" object, set its values, then use the collections .Add() method
and the example is always kind of like below, they name the objects, object1,object2,object3..etc. which is perfect if you know how may objects your going to have.
Example:
In my case, and most others probably, the number is unknown and determined when I get a dataview created. So my question is, how do I load those items into the collection in a generic fashion.
I picture this, but it doesn't seem to work most of the time, leaving only one object created.
Example of what I think should work:
1) create an "item" object, set its values, then use the collections .Add() method
and the example is always kind of like below, they name the objects, object1,object2,object3..etc. which is perfect if you know how may objects your going to have.
Example:
VB.NET:
Dim myResource1 As New DevExpress.XtraScheduler.Resource
myResource1.Caption = "Room 1"
Me.SchedulerStorage1.Resources.Add(myResource1)
Dim myResource2 As New DevExpress.XtraScheduler.Resource
myResource2.Caption = "Room 2"
Me.SchedulerStorage1.Resources.Add(myResource2)
In my case, and most others probably, the number is unknown and determined when I get a dataview created. So my question is, how do I load those items into the collection in a generic fashion.
I picture this, but it doesn't seem to work most of the time, leaving only one object created.
Example of what I think should work:
Thanks for any pointersdim oResourceObject as New DevExpress.XtraScheduler.Resource
' Get a dataview with all the records
Dim goResources As DataView = GetDataViewObject.GetDataView(cSQL)
Dim drv2 As DataRowView
For Each drv2 In goMeetProc
oResourceObject.Caption = drv2("ResourceName")
oResourceStartTime = drv2("ResourceStartTime")
Next
Last edited by a moderator: