pulpfiction Posted January 9, 2007 Share Posted January 9, 2007 Whats the difference between these 2 variable decleration?Dim doc As New System.Xml.XmlDocumentandDim doc As System.Xml.XmlDocumentI was trying to read data from a XML file. When code like below, load failed and went to catch directly, but when changed doc decleration to Dim doc As New System.Xml.XmlDocument, then it works fine... any explanation might help. ThanksDim doc As System.Xml.XmlDocumentTrydoc.Load("xmlfilename.xml")......Catch.....End Try Link to comment Share on other sites More sharing options...
aspnetguy Posted January 9, 2007 Share Posted January 9, 2007 XmlDocument is an object and you must create a new instance (New) before you can use it. It errored because you were trying to use it as a static member.Look up Classes and the difference between static and non static members Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now