RICHTEXTBOX VB.NET FORMAT PROBLEM

Discussion in 'Scripting & Programming' started by timark, Dec 9, 2007.

  1. timark

    timark New Member

    2
    0
    1
    Hi everyone
    I am new to VB.Net and i have a problem with my richtextbox control. I populate this control direct from an access database MEMO field. In VB6 when i assigned a the datafield to the richtextbox it would implant the information perfectly with formatting. Now with VB.net using the same datafield it plants the information without formatting and including all of the formatting paremeters


    Does anyone please have an explanation and/or fix for this.
     
  2. ffreeloader

    ffreeloader Terabyte Poster

    3,661
    106
    167
    I'm no VB.NET developer, but a little research shows that VB.NET requires you to use OO "methods" to format text in RichTextBoxes. The following link doesn't directly relate to data coming out of a database, but I can't see how where the data comes from would make a difference in how this works. All you're doing is applying formatting to text inside a box.

    http://www.startvbdotnet.com/controls/rtb.aspx

    Hope this helps. If not, well, I tried.
     
    Certifications: MCSE, MCDBA, CCNA, A+
    WIP: LPIC 1
  3. Fergal1982

    Fergal1982 Petabyte Poster

    4,196
    172
    211
    Yep. Its an absolute nightmare. I was trying to work out codes to format certain text in vb.net with RTB's, in the end I had to give in and use the method Freddie linked to. What you may just have to do is do a find and replace to format the text once its in there.

    If you find out how to do this? let me know.
     
    Certifications: ITIL Foundation; MCTS: Visual Studio Team Foundation Server 2010, Administration
    WIP: None at present
  4. Fergal1982

    Fergal1982 Petabyte Poster

    4,196
    172
    211
    Oh. One thing, how are you implanting the text? Are you just using the .Text method? You could try assigning the content to the .rtf method instead. If the contents of the MEMO field are built using the richtextbox, then they will likely have the proper rtf codes.
     
    Certifications: ITIL Foundation; MCTS: Visual Studio Team Foundation Server 2010, Administration
    WIP: None at present
  5. ffreeloader

    ffreeloader Terabyte Poster

    3,661
    106
    167
    Interesting. I would only call it a "nightmare" if all I understand was "functional" programming, as what I linked to is basic OO programming technique for any OO programming language. I was able to see what VB.NET needed just from my playing around with OO Python scripting.

    OO programming technique is really cool. I'm not really any good at it yet as I don't have enough experience with it, but I understand what's going on with it, and can see the value in it. It's so much easier to abstract problems out in OO thinking than in functional thinking it's amazing, at least to me anyway.
     
    Certifications: MCSE, MCDBA, CCNA, A+
    WIP: LPIC 1
  6. Fergal1982

    Fergal1982 Petabyte Poster

    4,196
    172
    211
    The nightmare was in that, since I was trying to colour format certain portions of the text dependant upon length from the previous end (I was putting in chat functionality, so coding the names), and for some reason, it was instantly colouring everything prior to that point in the text, despite what I was doing (which was more or less following the very link you supplied).
     
    Certifications: ITIL Foundation; MCTS: Visual Studio Team Foundation Server 2010, Administration
    WIP: None at present
  7. ffreeloader

    ffreeloader Terabyte Poster

    3,661
    106
    167
    Ah. I see what you mean.
     
    Certifications: MCSE, MCDBA, CCNA, A+
    WIP: LPIC 1

Share This Page

Loading...
  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.