windowsforms-devexpress-dot-xtrascheduler-dot-schedulerdatastorage-dot-createresource-x28-system-dot-object-system-dot-string-x29.md
Creates a new resource with the specified ID and a caption.
Namespace : DevExpress.XtraScheduler
Assembly : DevExpress.XtraScheduler.v25.2.dll
NuGet Package : DevExpress.Win.Scheduler
public Resource CreateResource(
object resourceId,
string resourceCaption
)
Public Function CreateResource(
resourceId As Object,
resourceCaption As String
) As Resource
| Name | Type | Description |
|---|---|---|
| resourceId | Object |
An object that is the unique resource identifier.
| | resourceCaption | String |
A string that is the resource caption accessible using the Resource.Caption property.
|
| Type | Description |
|---|---|
| Resource |
A Resource object.
|
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.
Resource resource = schedulerDataStorage.CreateResource(0, "TestResource");
schedulerDataStorage.Resources.Add(resource);
apt.ResourceId = resource.Id
Dim resource As Resource = schedulerStorage.CreateResource(0, "TestResource")
schedulerStorage.Resources.Add(resource)
apt.ResourceId = resource.Id
The following code snippets (auto-collected from DevExpress Examples) contain references to the CreateResource(Object, String) 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-sync-with-outlook/CS/SyncWithOutlook/Form1.cs#L206
{
Resource res = schedulerStorage1.CreateResource(i, String.Format("Resource {0}", i));
schedulerStorage1.Resources.Add(res);
winforms-scheduler-formatting-services/CS/FormattingServicesExample/Data/Data.cs#L24
for(int i = 1; i <= cnt; i++)
resources.Add(storage.CreateResource(i, Users[i - 1]));
winforms-scheduler-custom-draw-appointments/CS/CustomDrawDemo/Form1.cs#L56
for(int i = 1; i <= cnt; i++)
storage.Resources.Items.Add(storage.CreateResource(Guid.NewGuid(), Users[i - 1]));
}
winforms-scheduler-formatting-services/VB/FormattingServicesExample/Data/Data.vb#L21
For i As Integer = 1 To cnt
resources.Add(storage.CreateResource(i, Users(i - 1)))
Next
winforms-scheduler-custom-draw-appointments/VB/CustomDrawDemo/Form1.vb#L54
For i As Integer = 1 To cnt
storage.Resources.Items.Add(storage.CreateResource(Guid.NewGuid(), Users(i - 1)))
Next i
See Also