Results 1 to 3 of 3

Thread: Rich TextBox Alignment.

  1. #1

    Thread Starter
    Hyperactive Member tpfkanep's Avatar
    Join Date
    Jun 2002
    Location
    South Africa
    Posts
    272

    Rich TextBox Alignment.

    Hi,

    I have a form with a rich textbox control.

    I am trying to align text in the rich textbox with:

    VB Code:
    1. Dim a As String * 50
    2. Dim b As String * 10
    3. Dim c As String * 5
    4.  
    5. a = "AAAA"
    6. b = "BBB"
    7. c = "%%%"
    8. rtb.Text = a & vbTab & b & vbTab & c
    9.  
    10. a = "WWWW"
    11. b = "XXX"
    12. c = "F"
    13. rtb.Text = rtb.Text & vbCr & a & vbTab & b & vbTab & c
    14.  
    15. a = "QQQQQQQQQQQQQQQQQQQQQQQQQ"
    16. b = "TTTTTTTTTT"
    17. c = "10101"
    18. rtb.Text = rtb.Text & vbCr & a & vbTab & b & vbTab & c

    The text is not displayed in column-like fashion.
    I've tried to remove the * 50, *10, *5 from the Dim; changing fonts; but I just cannot seem to figure a way out.

    Any ideas?

    Thanx

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654
    Tabs come after certain periods. If text goes over, it jumps to the next. So only way would be to either set tabs into different places or then using a fixed length font (such as FixedSys or Courier New) and doing following:

    VB Code:
    1. Dim a As String * 50
    2. Dim b As String * 10
    3. Dim c As String * 5
    4.  
    5. rtb.Font.Name = "FixedSys"
    6. rtb.Font.Size = 9
    7.  
    8. a = "AAAA"
    9. b = "BBB"
    10. c = "%%%"
    11. rtb.Text = a & b & c
    12.  
    13. a = "WWWW"
    14. b = "XXX"
    15. c = "F"
    16. rtb.Text = rtb.Text & vbCrLf & a & b & c
    17.  
    18. a = "QQQQQQQQQQQQQQQQQQQQQQQQQ"
    19. b = "TTTTTTTTTT"
    20. c = "10101"
    21. rtb.Text = rtb.Text & vbCrLf & a & b & c

    Hope this is of any help.

  3. #3

    Thread Starter
    Hyperactive Member tpfkanep's Avatar
    Join Date
    Jun 2002
    Location
    South Africa
    Posts
    272
    Thank you!

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