Bug in Rich Text Box control tab setting array?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jim Haynes

    Bug in Rich Text Box control tab setting array?

    I cannot set the tab array for the Rich Text Box
    control. After I have text in the control, I try the
    following where rtb is the name of the rich text box
    control:

    rtb.selectall()
    Redim rtb.SelectionTa bs(5) 'to set 5 tabs
    rtb.SelectionTa bs(0) = 100 'pixels
    rtb.SelectionTa bs(1) = 200 'etc
    ....
    This has no effect on the selected text. Further I can
    immediatly read the contents of the SelectionTabs() array
    and all value remain zero. I have struggled for about 2
    weeks with every permutation of code and Rtb setting I
    can dream up and have not found a way to set the tabs.
    The previous VB6 Rich text box control worked fine. Is
    this a new bug?



  • Herfried K. Wagner [MVP]

    #2
    Re: Bug in Rich Text Box control tab setting array?

    * "Jim Haynes" <anonymous@disc ussions.microso ft.com> scripsit:[color=blue]
    > I cannot set the tab array for the Rich Text Box
    > control. After I have text in the control, I try the
    > following where rtb is the name of the rich text box
    > control:
    >
    > rtb.selectall()
    > Redim rtb.SelectionTa bs(5) 'to set 5 tabs
    > rtb.SelectionTa bs(0) = 100 'pixels
    > rtb.SelectionTa bs(1) = 200 'etc
    > ...
    > This has no effect on the selected text. Further I can
    > immediatly read the contents of the SelectionTabs() array
    > and all value remain zero. I have struggled for about 2
    > weeks with every permutation of code and Rtb setting I
    > can dream up and have not found a way to set the tabs.
    > The previous VB6 Rich text box control worked fine. Is
    > this a new bug?[/color]

    This code works fine for me (VS.NET 2003):

    \\\
    With Me.RichTextBox1
    .SelectAll()
    .SelectionTabs = New Integer() {100, 300, 400}
    End With
    ///

    --
    Herfried K. Wagner
    MVP · VB Classic, VB.NET
    <http://www.mvps.org/dotnet>

    <http://www.plig.net/nnq/nquote.html>

    Comment

    • Guest's Avatar

      #3
      Re: Bug in Rich Text Box control tab setting array?

      Thanks,

      That works fine for me on VB.net 2002 as well.
      Apparently it was a matter of understanding when I
      actually have a "New" instance of the selectionTabs()
      array.
      [color=blue]
      >-----Original Message-----
      >* "Jim Haynes" <anonymous@disc ussions.microso ft.com> [/color]
      scripsit:[color=blue][color=green]
      >> I cannot set the tab array for the Rich Text Box
      >> control. After I have text in the control, I try the
      >> following where rtb is the name of the rich text box
      >> control:
      >>
      >> rtb.selectall()
      >> Redim rtb.SelectionTa bs(5) 'to set 5 tabs
      >> rtb.SelectionTa bs(0) = 100 'pixels
      >> rtb.SelectionTa bs(1) = 200 'etc
      >> ...
      >> This has no effect on the selected text. Further I [/color][/color]
      can [color=blue][color=green]
      >> immediatly read the contents of the SelectionTabs() [/color][/color]
      array [color=blue][color=green]
      >> and all value remain zero. I have struggled for about [/color][/color]
      2 [color=blue][color=green]
      >> weeks with every permutation of code and Rtb setting I
      >> can dream up and have not found a way to set the [/color][/color]
      tabs. [color=blue][color=green]
      >> The previous VB6 Rich text box control worked fine. Is
      >> this a new bug?[/color]
      >
      >This code works fine for me (VS.NET 2003):
      >
      >\\\
      >With Me.RichTextBox1
      > .SelectAll()
      > .SelectionTabs = New Integer() {100, 300, 400}
      >End With
      >///
      >
      >--
      >Herfried K. Wagner
      >MVP · VB Classic, VB.NET
      ><http://www.mvps.org/dotnet>
      >
      ><http://www.plig.net/nnq/nquote.html>
      >.
      >[/color]

      Comment

      Working...