How to: Load a RichTextBox control using stream (non-filestream)
Posted on 2004-08-17
I have a RichTextBox control on a VB .NET form. I have successfully translated an XML document into RTF and would like to load it into the RichTextBox control without writing the results of the XSLT translation to a file... Thanks in advance for your help. Here's what I have so far:
Private Sub LoadRichTextBox()
Dim _XmlDoc As New XmlDocument()
Dim _XslDoc As New System.Xml.Xsl.XslTransform()
Dim _XmlTextWriter As XmlTextWriter
'**Dim _MemoryStream As New MemoryStream()
'transform to RTF and save it to file.
_XmlTextWriter = New XmlTextWriter("Temp.rtf", System.Text.Encoding.Default)
_XslDoc.Transform(_XmlDoc, Nothing, _XmlTextWriter)
'** _XslDoc.Transform(_XmlDoc, Nothing, _MemoryStream)
'** i would like to use a stream rather than a file here!
'** txtDsr.LoadFile(_MemoryStream, RichTextBoxStreamType.RichText)