Textbox

  • Thread starter Thread starter Brian Pittman
  • Start date Start date
B

Brian Pittman

Hi,

I can't for the life of me remeber how to do this (mental block I guess).
But how do I put the text from textbox_1 at the top of textbox_2 also
retaining textbox_2's text
any help is appreciated.

Brian
 
Hi Brian,

I think you can do that the best with the stringbuilder.

Something like (just typed here)
\\\
dim sb as new system.text.stringbuilder(textbox1.text)
sb.append(vbcrlf)
sb.append(textbox2.text)
textbox2.text=sb.tostring
////
(and I think is do it in those steps not in one time connected with a &)

The stringbuilder buildings strings real very much faster than the old
methods

I hope this helps?

Cor
 
Hi Cor,

Sorry if I'm being a damp squib here but a StringBiulder for a single
concat (or even a few small ones) gives no advantage. It comes into its own
when it reduces the number and/or size of temporary strings by a fairly decent
amount - such as within loops. The savings are due to reduced amounts of
copying and reduced GC activity.

Regards,
Fergus
 
Hi Fergus,

I did say something to Herfried it was I thought also, and then I did test
it and had to redraw my words.

This solution looks if it is to be used in a kind of loging system (and even
if it is not it could be).

The endstring has everytime to be past in a textbox at the end. Think on
some threads in this newsgroup.

So the string will be a little bit long. And every time x + x*n longer and
longer.

I have done some test with stringbuilder and it is in some cases I thought
minimal 100 times faster than all other approaches in even small string
tests.

Plus that I said yesterday to Jay B that I in future would only use
stringbuilder in my examples. So I did that in my first example that I had
of course.

And I believe it will make sence, did you thing that I had otherwise not
just concatenated that vbcrlf with a &.

And in this newsgroup you can never been a squib I think, this is good for
the discussion and if you don't believe you or me will make a testprogram.

Cor
 
Back
Top