1. Home
  2. Computing & Technology
  3. Visual Basic

Part 6: TripPlanner - A Complete WPF and XAML in Visual Basic
MainWindow Explained

By Dan Mabbutt, About.com

Nov 2 2008

Notice that the function to add another day and the function to change the information for one of the days are in the same box (Class, in this case) in the flowchart above. I did this because most of the logic is the same. The big difference is that when a day is added, a new child element has to be inserted into to the XML TripDates element and the Listbox first. To make this work, I instantiate the AddADay WPF form in two places and use different values passed in the Tag property in the instance to let the VB code for the AddADay form tell which function instantiated it. When a change is being made, the selected date is passed to the class in the Tag property.

Notice also the code structure ...

Dim TripInformation = XDocument.Load("TripInfo.xml")
Dim theTripDates = TripInformation...<TripDate>

This is LINQ to XML. You'll see this a lot in the rest of the program. In this particular case, the code gets the element containing all the dates in the XML file and then iterates through the list and adds them to the ListBox.

TripDesc, the first dialog window where the XML file is updated, is shown and explained on the next page.

Explore Visual Basic
By Category
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Using VB.NET
  5. Part 6: TripPlanner - A Complete XAML and WPF Application

©2009 About.com, a part of The New York Times Company.

All rights reserved.