Home All Groups Group Topic Archive Search About

tab function in a multiline text box

Author
15 Feb 2006 11:06 PM
amruta
When Iam doing the following:

                TextBox19.Text &= objReq.Name & ControlChars.Tab
                TextBox19.Text &= objReq.Number & ControlChars.Tab
                TextBox19.Text &= objReq.Owner & ControlChars.NewLine


                TextBox20.Text &= objReq.Name & ControlChars.Tab
                TextBox20.Text &= objReq.IDNumber & ControlChars.Tab
                TextBox20.Text &= objReq.Owner & ControlChars.NewLine

in text box 19 rows get printed well with proper tabs.

but in text box 20 first row does not get the first tab and then from 2nd
row it does fine.

Textbox19 looks like below:

tom      4565       john
alice     9090       sim

Textbox19 looks like below:

tom4565       john
alice     9090       sim

why wud that be??

Thank you !!

Author
16 Feb 2006 1:35 PM
Phill W.
"amruta" <amr***@discussions.microsoft.com> wrote in message
news:CC41EFFD-E67D-4EB1-9EE7-4F83C73CD363@microsoft.com...
> When Iam doing the following:
>
>                TextBox19.Text &= objReq.Name & ControlChars.Tab
>                TextBox19.Text &= objReq.Number & ControlChars.Tab
>                TextBox19.Text &= objReq.Owner & ControlChars.NewLine

BTW, if you're doing lots of string concatenation like the above, it's *far*
more efficient to do it all in one statement, as in

TextBox19.Text = TextBox19.Text  _
    & objReq.Name & ControlChars.Tab _
    & objReq.Number & ControlChars.Tab _
    & objReq.Owner & ControlChars.NewLine

> but in text box 20 first row does not get the first tab and then from 2nd
> row it does fine.

> tom4565       john
> alice     9090       sim

Are both textboxes using the same /font/?
Even tiny differences in the font settings could make the tab "seem"
to disappear.

HTH,
    Phill  W.
Author
16 Feb 2006 2:00 PM
Andrew Morton
Phill W. wrote:
> BTW, if you're doing lots of string concatenation like the above,
> it's *far* more efficient to do it all in one statement, as in
>
> TextBox19.Text = TextBox19.Text  _
>    & objReq.Name & ControlChars.Tab _
>    & objReq.Number & ControlChars.Tab _
>    & objReq.Owner & ControlChars.NewLine

How about TextBox19.AppendText(...) ?

Andrew
Author
16 Feb 2006 4:21 PM
Cerebrus99
I haven't seen the original question (Dunno where it is !), but I would
suggest using a StringBuilder in such cases, instead of using String
concatenation.

Regards,

Cerebrus.