Hi Meppy, Thank you for your speedy reply. It did help. I will just have to ask specific questions as I go. My problem is that your product is so powerful and feature rich it is hard to know what to use when. But I am sure that becomes second nature as I get into it. And I will have to work through more of the tutorials to learn.
I have a question about GetFreePeriod. Using tutorial one as my starting point, I modified the code as shown below. What I am trying to do is create two appointments. One has a resource and the other does not. I then have 2 buttons. One to get free period without regard to resource. And one to get free period relative to the assigned resource.
The first button getting free period without regard to resource works fine. It reports a start time at the end of the second appointment as I expected.
But the one for free period based on the resource, gives the same start time as the first appointment. I expected it to give me the end time of the first appointment. So I must be missing a setup somewhere. Please advise.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
calendar.BeginInit() calendar.TimetableSettings.Dates.Clear()
Dim i As Integer For i = 0 To 5
calendar.TimetableSettings.Dates.Add( _ DateTime.Today.Add(New TimeSpan(i, 0, 0, 0)))
Next i Dim app As New Appointment() app.HeaderText = "Meet George" app.DescriptionText = "This is a sample appointment" 'app.StartTime = New DateTime(2006, 1, 10, 14, 0, 0) 'app.EndTime = New DateTime(2006, 1, 10, 16, 30, 0) Dim startTime As Date = CDate(Format(Now, "MM/dd/yyyy") & " 01:00") app.StartTime = startTime app.EndTime = DateAdd(DateInterval.Minute, 210, startTime) 'app.Style.Brush = New MindFusion.Drawing.SolidBrush(Color.LightGreen) 'app.SelectedStyle.Brush = New MindFusion.Drawing.SolidBrush(Color.Red) app.Id = "1234"
Dim theResource As New MindFusion.Scheduling.Resource theResource.Id = "900009" theResource.Name = "Labeling Line" theResource.Tag = "900009" app.Resources.Add(theResource) calendar.Schedule.Items.Add(app) calendar.Schedule.Resources.Add(theResource)
Dim app2 As New Appointment() app2.HeaderText = "Appt with no resouce" app2.DescriptionText = "This is a sample appointment without a resource assigned." 'app.StartTime = New DateTime(2006, 1, 10, 14, 0, 0) 'app.EndTime = New DateTime(2006, 1, 10, 16, 30, 0) Dim startTime2 As Date = DateAdd(DateInterval.Minute, 300, startTime) Dim endTime2 As Date = DateAdd(DateInterval.Minute, 20, startTime2) app2.StartTime = startTime2 app2.EndTime = DateAdd(DateInterval.Minute, 210, startTime2) 'app.Style.Brush = New MindFusion.Drawing.SolidBrush(Color.LightGreen) 'app.SelectedStyle.Brush = New MindFusion.Drawing.SolidBrush(Color.Red) app2.Id = "5678" calendar.Schedule.Items.Add(app2)
calendar.Schedule.Items("1234").Style.Brush = New MindFusion.Drawing.SolidBrush(Color.Green) calendar.Schedule.Items("1234").SelectedStyle.Brush = New MindFusion.Drawing.SolidBrush(Color.CadetBlue)
calendar.TimetableSettings.VisibleColumns = 3
calendar.EndInit()
End Sub
Private Sub btnGetNextAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetNextAll.Click Dim theInterval As New TimeSpan(0, 40, 0, 0) Dim startTime As Date = CDate(Format(Now, "MM/dd/yyyy") & " 01:00") Dim endTime As Date = DateAdd(DateInterval.Day, 5, startTime) MessageBox.Show(Me.calendar.Schedule.GetFreePeriod(startTime, endTime, theInterval)) End Sub
Private Sub btnGetNextResource_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetNextResource.Click Dim theResources As New MindFusion.Scheduling.ResourceCollection Dim theResource As New MindFusion.Scheduling.Resource theResource.Id = "900009" theResource.Name = "Labeling Line" theResource.Tag = "900009" theResources.Add(theResource) Dim theInterval As New TimeSpan(0, 40, 0, 0) Dim startTime As Date = CDate(Format(Now, "MM/dd/yyyy") & " 01:00") Dim endTime As Date = DateAdd(DateInterval.Day, 5, startTime) MessageBox.Show(Me.calendar.Schedule.GetFreePeriod(startTime, endTime, theInterval, theResources)) End Sub
|