Here's the AddADay code
Partial Public Class AddADay
Dim TripInformation As XDocument
Private Sub AddADay_Loaded( _
ByVal sender As Object, _
ByVal e As System.Windows.RoutedEventArgs) _
Handles Me.Loaded
If Me.Tag = "A" Then
AddADay() ' AddADay called through click
Else
' AddADay called by double clicking date
StayAtDate.Text = Me.Tag
TripInformation = _
XDocument.Load("TripInfo.xml")
Dim StayAtElement = _
From TripDate _
In TripInformation...<TripDate> _
Where TripDate = StayAtDate.Text
StayAtDesc.Text = StayAtElement.@<StayAt>
TransDesc.Text = StayAtElement.@<Trans>
EventsDesc.Text = StayAtElement.@<Events>
End If
End Sub
Private Sub ExitDesc_Click( _
ByVal sender As System.Object, _
ByVal e As System.Windows.RoutedEventArgs) _
Handles ExitDesc.Click
Me.Close()
End Sub
Private Sub ContentChanged( _
ByVal sender As System.Object, _
ByVal e As System.Windows.RoutedEventArgs) _
Handles StayAtDesc.LostFocus, _
TransDesc.LostFocus, _
EventsDesc.LostFocus
TripInformation = XDocument.Load("TripInfo.xml")
Dim StayAtElement = _
From TripDate _
In TripInformation...<TripDate> _
Where TripDate = StayAtDate.Text
Select Case e.Source.name
Case "StayAtDesc"
StayAtElement.@StayAt = StayAtDesc.Text
Case "TransDesc"
StayAtElement.@Trans = TransDesc.Text
Case "EventsDesc"
StayAtElement.@Events = EventsDesc.Text
End Select
TripInformation.Save("TripInfo.xml")
End Sub
Private Sub AddADay()
TripInformation = XDocument.Load("TripInfo.xml")
Dim myTripDates = _
From tripdates _
In TripInformation...<TripDate>
Dim myTripDate = _
From tripdate _
In TripInformation...<TripDates>
Dim LastDate As Date = _
Date.Parse(myTripDates.Last().Value)
Dim LastDateString = _
Format(LastDate.AddDays(1), "MM/dd/yyyy")
StayAtDate.Text = LastDateString
myTripDate(0).Add( _
<TripDate><%= LastDateString %></TripDate>)
TripInformation.Save("TripInfo.xml")
End Sub
End Class

