Hi,
I dont know why you are getting the error at the new xmldocument
line. I would use the xmltextwriter class to write the xml document instead
of a streamwriter.
http://msdn.microsoft.com/library/de...classtopic.asp
Ken
--------------------------
"Maileen" <(E-Mail Removed)> wrote in message
news:ueN%(E-Mail Removed)...
> Hi,
>
> I finished my application butonce again i have some strange behavior with
> XML/text functions...
>
> for example, here below is a function which worked perfectly till now and
> now generate an error :
> "An unhandled exception of type 'System.NullReferenceException' occured in
> Unknown Module.
> Addition information : object reference not set to an instance of object"
> when i click on break, i can not get anymore information, but if i click
> on continue, my application works perfectly... :-(
>
> this error is raised after few sw.WriteLine commands...
> i have the same issue if i do :
>
> dim doc as XMLDocument
> doc = new XMLDocument (here occured error)
>
> where could be the problem ?
> from my point of view, some options in application could have such impact
> but which ones ?
>
> '-----------------------------------------
> ' Create_Empty_XML_SLAReport
> '-----------------------------------------
> ' create an empty settings.xml file
> Public Function Create_Empty_XML_SLAReport(ByVal sPath As String) As
> Boolean
> Dim sw As StreamWriter = New StreamWriter("SLAReport.xml")
> ' Add basic skeleton of file
> sw.WriteLine("<?xml version=""1.0""?>")
> sw.WriteLine("<SLAReport>")
> sw.WriteLine("<SourceFile>")
> sw.WriteLine("<Configuration>")
> sw.WriteLine("<ParameterIN id=""SLAReportSheetNumber"" type=""int""
> description=""SHEET NUMBER in Excel Sheet collection where are stored all
> data"">1</ParameterIN>")
> sw.WriteLine("<ParameterIN id=""Period"" type=""string""
> description=""Period on which report has been done"">A1</ParameterIN>")
> sw.WriteLine("<ParameterIN id=""FirstDataRow"" type=""int""
> description=""Number of first row which contains data for
> reporting"">4</ParameterIN>")
> sw.WriteLine("<ParameterIN id=""CancelColumn"" type=""string""
> description=""Letter of the column where is written CANCEL
> flag"">A</ParameterIN>")
> sw.WriteLine("<ParameterIN id=""TypeIssueColumn"" type=""string""
> description=""Letter of the column which contains Request or
> Order"">B</ParameterIN>")
> sw.WriteLine("<ParameterIN id=""EvidenceDateColumn"" type=""string""
> description=""Letter of the column where is written DATE of
> EVIDENCE"">C</ParameterIN>")
> sw.WriteLine("<ParameterIN id=""EvidenceNumberColumn"" type=""string""
> description=""Letter of the column where is written NUMBER of
> EVIDENCE"">D</ParameterIN>")
> sw.WriteLine("<ParameterIN id=""CustomerNameColumn"" type=""string""
> description=""Letter of the column where is written CUSTOMER
> NAME"">E</ParameterIN>")
> sw.WriteLine("<ParameterIN id=""TaskDescriptionColumn""
> type=""string"" description=""Letter of the column where is written TASK
> DESCRIPTION"">F</ParameterIN>")
> sw.WriteLine("<ParameterIN id=""DeadlineDateColumn"" type=""string""
> description=""Letter of the column where is written DEADLINE DATE when
> should be solved issue"">G</ParameterIN>")
> sw.WriteLine("<ParameterIN id=""SolvingDateColumn"" type=""string""
> description=""Letter of the column where is written DATE when issue was
> SOLVED"">H</ParameterIN>")
> sw.WriteLine("<ParameterIN id=""SolutionDescriptionColumn""
> type=""string"" description=""Letter of the column where is written
> SOLUTION DESCRIPTION"">I</ParameterIN>")
> sw.WriteLine("<ParameterIN id=""ModuleColumn"" type=""string""
> description=""Letter of the column where is written MODULE
> name"">J</ParameterIN>")
> sw.WriteLine("<ParameterIN id=""SLANumberColumn"" type=""string""
> description=""Letter of the column where is written SLA
> CATEGORY"">K</ParameterIN>")
> sw.WriteLine("<ParameterIN id=""DivisionColumn"" type=""string""
> description=""Letter of the column where is written DIVISION
> NAME"">L</ParameterIN>")
> sw.WriteLine("<ParameterIN id=""SupplierColumn"" type=""string""
> description=""Letter of the column where is written SUPPLIER
> NAME"">M</ParameterIN>")
> sw.WriteLine("<ParameterIN id=""CompanyColumn"" type=""string""
> description=""Letter of the column where is written COMPANY
> NAME"">N</ParameterIN>")
> sw.WriteLine("</Configuration>")
> sw.WriteLine("</SourceFile>")
> sw.WriteLine("<OutputFile>")
> sw.WriteLine("<ParameterOUT id=""test 3"">A 3rd test</ParameterOUT>")
> 'sw.WriteLine("</ParameterOUT>")
> sw.WriteLine("<TemplateFile>")
> sw.WriteLine("</TemplateFile>")
> sw.WriteLine("</OutputFile>")
> sw.WriteLine("</SLAReport>")
> sw.Close()
> End Function