Variable 'loNode' is used before it has been assigned a value. A null reference exception could result at runtime.
does anyone know why I am getting this error?
Imports System.Xml
Module Module1
Sub Main()
Dim doc As New XmlDocument
Dim loNode As XmlNode
Dim nodes As XmlNodeList
doc.Load("C:\Desktop\Template.xml")
nodes = doc.SelectNodes("program/databaseinfo")
loNode.SelectSingleNode("programshortname").InnerText = "PCF"
doc.Save("C:\New.xml")
loNode = Nothing
doc = Nothing
End Sub
End Module