Results 1 to 10 of 10

Thread: [2005] cant show text in richtextbox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    118

    Resolved [2005] cant show text in richtextbox

    hello!
    I've been trying to get this into a textbox but it don't seem to work. Prehaps you have a explanation.

    Code:
    g                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       g                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ø  g                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ð  g                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   è  g                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   à  g                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Ø	  g                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Ð  g                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   È
      g                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   À  g                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ¸  g                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   °  g                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ¨  g                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      gdf
    g
    dfg
    ergreger
    ger
    ger
    g
    erg
    er
    g                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ˜
    (note a key dont get into this box and i belive it is a chr(0) )

    and dont say "use richtextbox.loadfile(file) becouse i have already tried that. And a streamreader.
    i have tried to get rid of the chr(0) many times too.
    And when i update my richtextbox very fast i seem to get more letters into it.
    Last edited by hallongodis; Aug 7th, 2007 at 04:54 PM.

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: [2005] cant show text in richtextbox

    What is the problem? It also helps if you show your code.

  3. #3
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: [2005] cant show text in richtextbox

    Explain your question clearly.

    Specifically -
    "and dont say "use richtextbox.loadfile(file) becouse i have already tried that."
    Okay, and why didn't that work? Because I just copied your text, put it in a text file and loaded it just like this.

    "And a streamreader."
    And what about a StreamReader?

    "And when i update my richtextbox very fast i seem to get more letters into it."
    Huh?

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    118

    Re: [2005] cant show text in richtextbox

    Ok.
    I am trying to convert a old vb6 program to my new vb 2005 program.
    The problem is that i have the code from him but i cant give the code out that is why i am going to have a hard time explaining.

    But first i need to get some text in my richtextbox
    But the richtextbox dose'nt accept the textfile and just give me the first post of it (the first 500 letters before Chr(0)) and i am wondering how to get the whole textfile instead of just g

    i have olso tried a streamreader to solve the problem without success...

  5. #5
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: [2005] cant show text in richtextbox

    I copied the text from your first post and got 6590 characters in the RichTextBox.

    vb.net Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.     Me.RichTextBox1.LoadFile("c:\test.txt", RichTextBoxStreamType.PlainText)
    3.     MessageBox.Show(Me.RichTextBox1.Text.Length.ToString())
    4. End Sub

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    118

    Re: [2005] cant show text in richtextbox

    i said in the first post that Chr(0) isnt displayed on the site so the reason must be that..

    *edit* Umm... is there a difference between me.richtextbox.text and richtextbox.text because it seemed to work this time :S
    Last edited by hallongodis; Aug 7th, 2007 at 04:28 PM.

  7. #7
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: [2005] cant show text in richtextbox

    Quote Originally Posted by hallongodis
    *edit* Umm... is there a difference between me.richtextbox.text and richtextbox.text because it seemed to work this time :S
    There is no difference. But I always use the Me keyword as it makes it clear that you are referring to the current instance of a class and you get Intellisense after just 3 characters.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    118

    Re: [RESOLVED] [2005] cant show text in richtextbox

    :S strange how did it magicaly work when i typed me.richtextbox when it completly denied my old code

  9. #9
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: [RESOLVED] [2005] cant show text in richtextbox

    Possibly because you named your RichTextBox richtextbox? I don't know. At any rate I'd avoid naming your controls the actual class name.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    118

    Re: [RESOLVED] [2005] cant show text in richtextbox

    oh and now i am trying to put that text form richtextbox.text to richtextbox2.text and for each 500 chars it should move onto a new line.

    my code witch dont seem to work..
    Code:
     Me.Start.LoadFile(Application.StartupPath & "\adress.txt", RichTextBoxStreamType.PlainText)
            Me.Start.SaveFile(Application.StartupPath & "\Adressbkup.txt", RichTextBoxStreamType.PlainText)
            Dim m As String
            Dim i As Integer
            Dim i2 As Integer
            Dim i3 As Integer
            Dim testing As String
            i2 = 1
            For i2 = 0 To Start.Lines.LongLength
                If Slut.Text = "" Then
                    i3 = 0
                    i = i + 500
                    m = Start.Text.Trim.Substring(i3, i)
                    testing = Slut.Text()
                    Slut.Text = m
                    i = i + 500
                Else
                    i3 = i3 + 500
                    i = i + 500
                    testing = Slut.Text & ControlChars.Lf
                    Slut.Text = testing
                    m = Start.Text.Trim.Substring(i3, i)
                    Slut.Text = m
                End If
    
    
            Next i2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width