Loading RichTextbox in VB

Discussion in 'Visual Basic ( VB )' started by TheMan, Dec 8, 2010.

  1. TheMan

    TheMan New Member

    Joined:
    Dec 8, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    I am Currently trying to load my RichTextbox with "notes" which is passed up as a byte array from the database to this code. For some reason the array makes it all the way here but it only puts a space in the richtextbox. Am i missing somthing or doing something wrong?

    VB CODE
    Code:
    Dim memoryStream As System.IO.MemoryStream = New System.IO.MemoryStream()
    
                    Dim txtRange As TextRange = New TextRange(RichTextBoxNotes.Document.ContentStart,
                                                         RichTextBoxNotes.Document.ContentEnd)
                    txtRange.Save(memoryStream, System.Windows.DataFormats.Rtf)
                    Dim byteArray(objCall.Notes.Length - 1) As Byte
                    byteArray = memoryStream.ToArray()
                    txtRange.Load(New System.IO.MemoryStream(byteArray), DataFormats.Rtf)
                    RichTextBoxNotes.DataContext = txtRange.Text
    Thanks
     
  2. virxen

    virxen Active Member

    Joined:
    Nov 24, 2009
    Messages:
    387
    Likes Received:
    90
    Trophy Points:
    28
    if you print this--->txtRange.Text what you get?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice