M
muskito.net
Hi,
I Have the following code:
Public Sub UpdateEvent(ByVal ID As Integer, _
ByVal StartTime As Integer, _
ByVal Duration As Integer)
EventId = ID
Dim EventToUpdate As SchedulerEvent =
SchedulerEvents.Find(AddressOf FindById)
EventToUpdate.StartTime = StartTime
EventToUpdate.Duration = Duration
End Sub
SchedulerEvent is a Structure
SchedulerEvents is a List(of SchedulerEvent)
When i run this, the Find method Does find the correct object
corresponding to the ID Supplied.
However - When I Update the StartTime and Duration of the object - it
does not update the actual list...
when i tried to check whether the reference between the two equals
using:
SchedulerEvent.ReferenceEquals(SchedulerEvents(1),EventToUpdate)
(I Only added two items to the list and tried to update the second one)
It was found to be False (this explains why the values aren't actually
beeing updated in the list).
My Questions are:
1. Why doesn't it keep the reference, and making updates like such will
work?
2. Is there something wrong with my code?
3. Is there a WorkAround you know that might work?
Thanks alot...
I Have the following code:
Public Sub UpdateEvent(ByVal ID As Integer, _
ByVal StartTime As Integer, _
ByVal Duration As Integer)
EventId = ID
Dim EventToUpdate As SchedulerEvent =
SchedulerEvents.Find(AddressOf FindById)
EventToUpdate.StartTime = StartTime
EventToUpdate.Duration = Duration
End Sub
SchedulerEvent is a Structure
SchedulerEvents is a List(of SchedulerEvent)
When i run this, the Find method Does find the correct object
corresponding to the ID Supplied.
However - When I Update the StartTime and Duration of the object - it
does not update the actual list...
when i tried to check whether the reference between the two equals
using:
SchedulerEvent.ReferenceEquals(SchedulerEvents(1),EventToUpdate)
(I Only added two items to the list and tried to update the second one)
It was found to be False (this explains why the values aren't actually
beeing updated in the list).
My Questions are:
1. Why doesn't it keep the reference, and making updates like such will
work?
2. Is there something wrong with my code?
3. Is there a WorkAround you know that might work?
Thanks alot...