[RESOLVED] Memory stream to textbox
Hi all, im trying to get a memory stream to a textbox, the memory stream is of a .txt or .ini file that is extracted from a archive to a memory stream.
Heres what ive got so far:
vb Code:
Dim MSData As New System.IO.MemoryStream()
Dim Infile As String = ComboBox10.SelectedValue 'The input archive
Dim passww As String = TextBox1.Text 'Archive password
Using extr As New SevenZipExtractor(Infile, passww)
extr.ExtractFile("02.ini", MSData)
End Using
Dim sr As StreamReader = New StreamReader(MSData)
Dim textSsS As String = sr.ReadToEnd()
ini02.Text = textSsS
The problem is that ini02.text stays blank, so i know im missing somethign but not sure what, can anybody help
Thanks
EDIT: Sves bumping a solved thread, Thanks jmcilhinney, setting the possition fixed the problem.
Re: Memory stream to textbox
Try setting the Position of the MemoryStream to zero before reading.
Re: Memory stream to textbox
Also, don't forget to close your StreamReader and Dispose your MemoryStream. You should have Using blocks to create them so that it will be done implicitly.