Hammy
Freshman
I am looking at the following code, and wondering about the variable declarations before the Page_Load event. Specifically, I am wondering why they would declare them as private. I understand that private means that the code is only available to the scope it is declared in, but I am wondering what declaring a gobal page variable as private acomplishes.
Code:
<script runat="server">
Private i as Integer
Private strOutPut as String = ""
Sub Page_Load(obj as Object, e as EventArgs)
dim xmldoc as new XMLDocument()
try
xmldoc.Load(Server.MapPath(("books.xml"))
ShowTree(xmlDoc.DocumentElement)
catch ex as Exception
strOutput = "Error accessing XML file"
end try
output.Text = strOutput
End Sub
</script>