Where are your Events being Stored? are they on a database?
Anyway the logic for comparing the two events to see if there is a clash is something like this:
Sub CompareEvents (byref Event1Start as datetime, byref Event1End as DateTime, byRef Event2Start as Datetime, ByRef Event2End as Datetime)
IF (Event1Start < = Event2End) AndAlso (Event1End = > Event2Start) then
'Overlap Event2 ends after event1 starts and Starts before Event one ends
ElseIf (Event2Start < = Event1End) AndAlso (Event2End = > Event1Start) Then
'Overlap Event 1 ends after Event2 starts and starts before Event2 ends
If they are on a database then you could run a query to check for conflicts before adding.
sSQL = "SELECT COUNT(*) AS NoOfConflicts From MyEvents" & _
"WHERE ((@EventStart <= EndDate) AND (@EventEnd => Startdate)) " & _
"OR ((StartDate <= @EventEnd) AND (EndDate => @EventStart)"
'Ill Assume you have SQL Server
dim cmd as new sqlCommand
dim conn as new sqlConnection(MyConnectionString)
.commandType = CommandType.Text
.CommandText = sSQL
.Connection = conn
IF Conn.State <> ConnectionState.Open then
if cmd.ExecuteScalar() >0 then
'There is a conflict
Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...