I'm probably missing something really simple or trying too much at once but it's 16:30 on a Friday afternoon and my head is wrecked!!
Basically, I'm trying to build an application that takes out put from a database query as XML and uses XSL to transform it into HTML which is then displayed in a web browser controll on another form.
I thought I break it up into pieces so I decided to just create an XML file and an XSL stylesheet and read this into the web browser control but all I'm getting is
Here is my code:
Dim frmViewer As New frmProcessReportViewer 'New Form' 'Create an XMLCompiledTransform object and load the XSL stylesheet.' Dim doc As XPathDocument = New XPathDocument("CDCollection.Xml") Dim Transform As XslCompiledTransform = New XslCompiledTransform Dim Settings As XsltSettings = New XsltSettings Settings.EnableScript = True Transform.Load("CD.xsl", Settings, Nothing) 'need a stream to put it all into' Dim HTMLStream As New MemoryStream() Dim StreamWriter As New StreamWriter(HTMLStream, Encoding.Default) 'Place HTML into our StreamWriter' Transform.Transform(doc, Nothing, StreamWriter) 'Populate the Stream StreamWriter.Flush() 'Set the WebBrowser.DocumentStream = HTML stream' 'Remember to "AllowNavigation" in Browser otherwise the thing doesn't work.' frmViewer.WebBrowser1.AllowNavigation = True frmViewer.WebBrowser1.DocumentStream = HTMLStream 'wait until finished' Application.DoEvents() 'show as a modal' frmViewer.ShowDialog()
Anyone tried anything like this before? Our eventual aim to to be able to produce reports in our application form the database without having to use Crystal etc.