Back to Devexpress

SchedulerDataStorage.CreateResource(Object) Method

windowsforms-devexpress-dot-xtrascheduler-dot-schedulerdatastorage-dot-createresource-x28-system-dot-object-x29.md

latest5.9 KB
Original Source

SchedulerDataStorage.CreateResource(Object) Method

Creates a new resource with the specified ID.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.dll

NuGet Package : DevExpress.Win.Scheduler

Declaration

csharp
public Resource CreateResource(
    object resourceId
)
vb
Public Function CreateResource(
    resourceId As Object
) As Resource

Parameters

NameTypeDescription
resourceIdObject

An object that is the unique resource identifier.

|

Returns

TypeDescription
Resource

A Resource object.

|

Remarks

Use the CreateResource method to create a new resource. This method also creates all the required custom fields and adds them to the resource’s CustomFieldCollection , available via the PersistentObject.CustomFields property. To add custom fields to the resource manually, use the PersistentObjectStorage<T>.CreateCustomFields method.

csharp
Resource resource = schedulerDataStorage.CreateResource(0); 
schedulerDataStorage.Resources.Add(resource); 
apt.ResourceId = resource.Id
vb
Dim resource As Resource = schedulerStorage.CreateResource(0) 
schedulerStorage.Resources.Add(resource) 
apt.ResourceId = resource.Id

The following code snippets (auto-collected from DevExpress Examples) contain references to the CreateResource(Object) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-scheduler-manage-resources-runtime/CS/SchedulerResourcesManagement/ResourceForm.cs#L34

csharp
this.editedResourceCopy = schedulerStorage.CreateResource(null);
this.sourceResource = resource;

winforms-scheduler-bind-to-xpo/CS/XPO_XtraScheduler_Simple_Example/Form1.cs#L28

csharp
if (xpResourceCollection.Count == 0) {
    Resource res1 = schedulerDataStorage1.CreateResource(1);
    res1.Caption = "First Resource";

winforms-scheduler-customize-popup-menu/CS/PopupMenuCustomization/MySchedulerHelper.cs#L14

csharp
for(int i = 1; i <= cnt; i++) {
    Resource resource = storage.CreateResource(i);
    resource.Caption = Users[i - 1];

winforms-scheduler-drag-drop-appointments-from-grid/CS/T179722/DataHelper.cs#L41

csharp
for(int i = 1; i <= cnt; i++) {
    Resource resource = storage.CreateResource(i);
    resource.Caption = Users[i - 1];

winforms-scheduler-manage-resources-runtime/VB/SchedulerResourcesManagement/ResourceForm.vb#L51

vb
Me.editedResourceCopy_Renamed = schedulerStorage.CreateResource(Nothing)
Me.sourceResource_Renamed = resource

winforms-scheduler-bind-to-xpo/VB/XPO_XtraScheduler_Simple_Example/Form1.vb#L28

vb
If xpResourceCollection.Count = 0 Then
    Dim res1 As Resource = schedulerDataStorage1.CreateResource(1)
    res1.Caption = "First Resource"

winforms-scheduler-customize-popup-menu/VB/PopupMenuCustomization/MySchedulerHelper.vb#L14

vb
For i As Integer = 1 To cnt
    Dim resource As Resource = storage.CreateResource(i)
    resource.Caption = Users(i - 1)

winforms-scheduler-drag-drop-appointments-from-grid/VB/T179722/DataHelper.vb#L19

vb
For i As Integer = 1 To cnt
    Dim resource As Resource = storage.CreateResource(i)
    resource.Caption = Users(i - 1)

See Also

SchedulerDataStorage Class

SchedulerDataStorage Members

DevExpress.XtraScheduler Namespace