DeanMc
Jan 27th, 2009, 06:45 AM
Hi guys,
So I have found a way to getting text out of an RTB like so:
Imports System.IO
Imports System.Text
Class Window1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
Dim tr As New TextRange(RichTextBox1.Document.ContentStart, RichTextBox1.Document.ContentEnd)
Dim ms As New MemoryStream
tr.Save(ms, DataFormats.Text)
Dim MyArray As String = ASCIIEncoding.Default.GetString(ms.ToArray())
End Sub
End Class
The issue im having is that the string from the last line only seems to be 1 string I thought it would be an array of strings? It could be my rusty array logic? any idea's?
So I have found a way to getting text out of an RTB like so:
Imports System.IO
Imports System.Text
Class Window1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
Dim tr As New TextRange(RichTextBox1.Document.ContentStart, RichTextBox1.Document.ContentEnd)
Dim ms As New MemoryStream
tr.Save(ms, DataFormats.Text)
Dim MyArray As String = ASCIIEncoding.Default.GetString(ms.ToArray())
End Sub
End Class
The issue im having is that the string from the last line only seems to be 1 string I thought it would be an array of strings? It could be my rusty array logic? any idea's?