Querystring code translation into vb.net. Help please!

.net starter

New member
Joined
Apr 19, 2007
Messages
1
Programming Experience
Beginner
Hi! I’m creating a route planning application for a small area. I have 2 drop down lists on the GUI that specify where the user is travelling from and to. I need to write the code to make the drop down lists work and to separate the routes out when selected by the user. I’m going to replace the current XML file (with the route coordinates stored) with a dynamic aspx page so that I can pass the parameters (start point and end point) in the querystring. I have a kind of pseudo code (below) but I’m only a beginner and need some help translating this into VB.NET (I've already had a go at the first bit). Any help would be much appreciated!

// Declare start and end point variables

Dim startPt As Integer = document.forms[0].listStartPoint.value;
Dim endPt As Integer = document.forms[0].listEndPoint.value;

//create a new object to manipulate the XML document

Dim dataDoc As System.Xml.XmlDocument = New System.Xml.XmlDocument()dataDoc.Load("data.xml")

//This document will contain final filtered XML with only the lines the user is interested in

Dim outputDataDoc As System.Xml.XmlDocument = NewSystem.Xml.XmlDocument()
outputDataDoc.Load("<lines/>")

//Determine the start and endpoint

Dim startPt As String = Request.QueryString["startpoint"];
Dim endPt As String= Request.QueryString["endpoint"];

//I should now have an XML document with all the lines, the start point and the end point, and an empty XML document to add the required lines to
//****the next part of code needs to be translated to vb.net (yet to be done)****

string nextStartpoint = startPt

while (nextStartpoint != endPt)
{

//find the line with the start point that matches

xmlNodeList = dataDoc.selectNodes("//line@endpoint="" + nextStartPoint + "")

//xmlNodeList now contains a list of nodes that contain the start point
//pick the first one and add it to the output document

outputDataDoc.documentElement.AppendNode(xmlNodelist.nodes[0].clone(true))

//set the start point to be the end point of the last line in the xml

nextStartPoint = xmlNodelist.nodes[0].attributes("endpoint").value
}

//lines have been added to the output doc so now i can output the xml with only the lines that match the route

Response.clear() //clear the html

Response.Write(outputDataDoc.OuterXML)

Response.end()
 
Back
Top