Really dumb textbox newbie question.. 
Author Message
 Really dumb textbox newbie question..

*Disclaimer - This is a moronic question. I've looked through my VB book and the help file
for some time before deciding to humiliate myself by posting a question so basic.

I have a program that writes 2 lines of text to a text box. I have the multiline property
of the textbox set to true. Nevertheless, the 2nd line displayed keeps overwriting the first.
What am I doing wrong?

Thanks to whoever answers..

--
   |\      _,,,---,,_
   /,`.-'`'    -.  ;-;;,_
  |,4-  ) )-,_..;\ (  `'-
 `---''(_/--'  `-'\_)



Sat, 15 Jul 2000 03:00:00 GMT  
 Really dumb textbox newbie question..

Hello Chad,

I'm going to assume that you code reads something like this:

    Text1.Text = "This is line One"
    Text1.Text = "This is line Two"

A few things about this code.  The first line of code is not smart enough to
know about the second line of code.  Each line of code is executed
independently of each other.  When you say Text1.Text = something, it is
interpreting that as place something in the text property of the control
Text1.  It does NOT say append this to the end of what is already in the
text property of the Text1 control.  This does however:

    Text1.Text = "This is line One"
    Text1.Text = Text1.Text & vbCrLf ' add a carriage return/line feed pair
    Text1.Text = Text1.Text & "This is line Two"

Get it?  The & operator is the string concatenation operator (you can look
it up in the help).  It joins two strings together.  vbCrLf is an intrinsic
constant provided by VBA itself (see the object browser for details).  It is
the invisible carriage return and line feed pair that moves ANSI text to the
next line.  So, when I say:

    Text1.Text = Text1.Text & vbCrLf

I'm really saying put into Text1.Text the current value of Text1.Text as
well as a Carriage Return and A Line Feed.  And when I say:

    Text1.Text = Text1.Text & "This is line Two"

I'm really saying put into Text1.Text the current value of Text1.Text (now
including a CRLF) and the literal string "This is line Two".

I hope this helps,

Larry R. Tubbs Jr., MCPS, MCSD
Silverleaf Resorts Inc, NYSE: SVR

Quote:

>*Disclaimer - This is a moronic question. I've looked through my VB book
and the help file
>for some time before deciding to humiliate myself by posting a question so
basic.

>I have a program that writes 2 lines of text to a text box. I have the
multiline property
>of the textbox set to true. Nevertheless, the 2nd line displayed keeps

overwriting the first.
Quote:
>What am I doing wrong?

>Thanks to whoever answers..

>--
>   |\      _,,,---,,_
>   /,`.-'`'    -.  ;-;;,_
>  |,4-  ) )-,_..;\ (  `'-
> `---''(_/--'  `-'\_)



Sat, 15 Jul 2000 03:00:00 GMT  
 Really dumb textbox newbie question..

Can't say for sure, but consider these examples:

BAD:
    text1.text = "this is line 1"
    text1.text = "this is line 2" ' this will overwrite

GOOD:
    text1.text = "this is line 1"
    text1.text = text1.text & vbcrlf & "this is line 2"

ALSO GOOD:
    text1.text = "this is line 1" & vbcrlf & "this is line 2"

Hope this helps!

Quote:

>*Disclaimer - This is a moronic question. I've looked through my VB book
and the help file
>for some time before deciding to humiliate myself by posting a question so
basic.

>I have a program that writes 2 lines of text to a text box. I have the
multiline property
>of the textbox set to true. Nevertheless, the 2nd line displayed keeps

overwriting the first.
Quote:
>What am I doing wrong?

>Thanks to whoever answers..

>--
>   |\      _,,,---,,_
>   /,`.-'`'    -.  ;-;;,_
>  |,4-  ) )-,_..;\ (  `'-
> `---''(_/--'  `-'\_)



Sat, 15 Jul 2000 03:00:00 GMT  
 Really dumb textbox newbie question..

Quote:

> *Disclaimer - This is a moronic question. I've looked through my VB book and the help file
> for some time before deciding to humiliate myself by posting a question so basic.

> I have a program that writes 2 lines of text to a text box. I have the multiline property
> of the textbox set to true. Nevertheless, the 2nd line displayed keeps overwriting the first.
> What am I doing wrong?

> Thanks to whoever answers..

> --
>    |\      _,,,---,,_
>    /,`.-'`'    -.  ;-;;,_
>   |,4-  ) )-,_..;\ (  `'-
>  `---''(_/--'  `-'\_)

Post your code when you ask a qustion like this; otherwise we're just
guessing.

If you're doing something like...

Text1.text = "this is line 1"

then later..

Text1.text = "this is line 2"

Then this will overwrite line 1. what you have to do is append the new
text to the old with the "&" operator, also add a carriage return line
feed to start a new line.

Text1.text = Text1.text & vbCrLf & "this is line 2"



Sat, 15 Jul 2000 03:00:00 GMT  
 Really dumb textbox newbie question..

Text1.Text = "String1" & vbCrLf & "String2"

Lee Weiner
weiner AT fuse DOT net


Quote:

>*Disclaimer - This is a moronic question. I've looked through my VB book and
> the help file
>for some time before deciding to humiliate myself by posting a question so
> basic.

>I have a program that writes 2 lines of text to a text box. I have the
> multiline property
>of the textbox set to true. Nevertheless, the 2nd line displayed keeps
> overwriting the first.
>What am I doing wrong?

>Thanks to whoever answers..



Sun, 16 Jul 2000 03:00:00 GMT  
 Really dumb textbox newbie question..

Why do all of that work, simple solution:
Text1.text="This is line one."+chr$(13)+"This is linetwo."

or if you want to do the first, then after some other event do the second
then
Text1.text="This is line one."

Do what ever

Text1.text=text1.text+chr$(13)+"This is line two."

--
Please e-mail a copy of the response to

Sometimes my news server does not function properly,
Thank You.

Quote:

>Hello Chad,

>I'm going to assume that you code reads something like this:

>    Text1.Text = "This is line One"
>    Text1.Text = "This is line Two"

>A few things about this code.  The first line of code is not smart enough
to
>know about the second line of code.  Each line of code is executed
>independently of each other.  When you say Text1.Text = something, it is
>interpreting that as place something in the text property of the control
>Text1.  It does NOT say append this to the end of what is already in the
>text property of the Text1 control.  This does however:

>    Text1.Text = "This is line One"
>    Text1.Text = Text1.Text & vbCrLf ' add a carriage return/line feed pair
>    Text1.Text = Text1.Text & "This is line Two"

>Get it?  The & operator is the string concatenation operator (you can look
>it up in the help).  It joins two strings together.  vbCrLf is an intrinsic
>constant provided by VBA itself (see the object browser for details).  It
is
>the invisible carriage return and line feed pair that moves ANSI text to
the
>next line.  So, when I say:

>    Text1.Text = Text1.Text & vbCrLf

>I'm really saying put into Text1.Text the current value of Text1.Text as
>well as a Carriage Return and A Line Feed.  And when I say:

>    Text1.Text = Text1.Text & "This is line Two"

>I'm really saying put into Text1.Text the current value of Text1.Text (now
>including a CRLF) and the literal string "This is line Two".

>I hope this helps,

>Larry R. Tubbs Jr., MCPS, MCSD
>Silverleaf Resorts Inc, NYSE: SVR


>>*Disclaimer - This is a moronic question. I've looked through my VB book
>and the help file
>>for some time before deciding to humiliate myself by posting a question so
>basic.

>>I have a program that writes 2 lines of text to a text box. I have the
>multiline property
>>of the textbox set to true. Nevertheless, the 2nd line displayed keeps
>overwriting the first.
>>What am I doing wrong?

>>Thanks to whoever answers..

>>--
>>   |\      _,,,---,,_
>>   /,`.-'`'    -.  ;-;;,_
>>  |,4-  ) )-,_..;\ (  `'-
>> `---''(_/--'  `-'\_)



Sun, 16 Jul 2000 03:00:00 GMT  
 Really dumb textbox newbie question..

thanks to all who took the time to respond, I got it working fine now..
:)

thanks again..

: Why do all of that work, simple solution:
: Text1.text="This is line one."+chr$(13)+"This is linetwo."

: or if you want to do the first, then after some other event do the second
: then
: Text1.text="This is line one."

: Do what ever

: Text1.text=text1.text+chr$(13)+"This is line two."

: --
: Please e-mail a copy of the response to

: Sometimes my news server does not function properly,
: Thank You.
: >Hello Chad,
: >
: >I'm going to assume that you code reads something like this:
: >
: >    Text1.Text = "This is line One"
: >    Text1.Text = "This is line Two"
: >
: >A few things about this code.  The first line of code is not smart enough
: to
: >know about the second line of code.  Each line of code is executed
: >independently of each other.  When you say Text1.Text = something, it is
: >interpreting that as place something in the text property of the control
: >Text1.  It does NOT say append this to the end of what is already in the
: >text property of the Text1 control.  This does however:
: >
: >    Text1.Text = "This is line One"
: >    Text1.Text = Text1.Text & vbCrLf ' add a carriage return/line feed pair
: >    Text1.Text = Text1.Text & "This is line Two"
: >
: >Get it?  The & operator is the string concatenation operator (you can look
: >it up in the help).  It joins two strings together.  vbCrLf is an intrinsic
: >constant provided by VBA itself (see the object browser for details).  It
: is
: >the invisible carriage return and line feed pair that moves ANSI text to
: the
: >next line.  So, when I say:
: >
: >    Text1.Text = Text1.Text & vbCrLf
: >
: >I'm really saying put into Text1.Text the current value of Text1.Text as
: >well as a Carriage Return and A Line Feed.  And when I say:
: >
: >    Text1.Text = Text1.Text & "This is line Two"
: >
: >I'm really saying put into Text1.Text the current value of Text1.Text (now
: >including a CRLF) and the literal string "This is line Two".
: >
: >I hope this helps,
: >
: >Larry R. Tubbs Jr., MCPS, MCSD
: >Silverleaf Resorts Inc, NYSE: SVR

: >

: >>
: >>*Disclaimer - This is a moronic question. I've looked through my VB book
: >and the help file
: >>for some time before deciding to humiliate myself by posting a question so
: >basic.
: >>
: >>I have a program that writes 2 lines of text to a text box. I have the
: >multiline property
: >>of the textbox set to true. Nevertheless, the 2nd line displayed keeps
: >overwriting the first.
: >>What am I doing wrong?
: >>
: >>
: >>Thanks to whoever answers..
: >>
: >>--
: >>   |\      _,,,---,,_
: >>   /,`.-'`'    -.  ;-;;,_
: >>  |,4-  ) )-,_..;\ (  `'-
: >> `---''(_/--'  `-'\_)
: >>
: >>
: >
: >

--
   |\      _,,,---,,_
   /,`.-'`'    -.  ;-;;,_
  |,4-  ) )-,_..;\ (  `'-
 `---''(_/--'  `-'\_)



Sun, 16 Jul 2000 03:00:00 GMT  
 Really dumb textbox newbie question..


Quote:

>*Disclaimer - This is a moronic question. I've looked through my VB book and the help file
>for some time before deciding to humiliate myself by posting a question so basic.

>I have a program that writes 2 lines of text to a text box. I have the multiline property
>of the textbox set to true. Nevertheless, the 2nd line displayed keeps overwriting the first.
>What am I doing wrong?

>Thanks to whoever answers..

>--
>   |\      _,,,---,,_
>   /,`.-'`'    -.  ;-;;,_
>  |,4-  ) )-,_..;\ (  `'-
> `---''(_/--'  `-'\_)

Im only a begginer myself,but you might try setting the word wrap
property to true also,i hope this helps a little,and if not,wish i
knew more to tell you


Mon, 17 Jul 2000 03:00:00 GMT  
 Really dumb textbox newbie question..

if youre code is something like the following

text1.text = "firstline"
text1.text = "secondline"

try changing it to

text1.text  = "firstline"
text1.text = text1.text & vbcrlf & "secondline"

This will concatonate the socond line to the first without deleting the
first in the process

Cheers



Quote:

> >*Disclaimer - This is a moronic question. I've looked through my VB book
and the help file
> >for some time before deciding to humiliate myself by posting a question
so basic.

> >I have a program that writes 2 lines of text to a text box. I have the
multiline property
> >of the textbox set to true. Nevertheless, the 2nd line displayed keeps

overwriting the first.
Quote:
> >What am I doing wrong?

> >Thanks to whoever answers..

> >--
> >   |\      _,,,---,,_
> >   /,`.-'`'    -.  ;-;;,_
> >  |,4-  ) )-,_..;\ (  `'-
> > `---''(_/--'  `-'\_)

> Im only a begginer myself,but you might try setting the word wrap
> property to true also,i hope this helps a little,and if not,wish i
> knew more to tell you



Mon, 17 Jul 2000 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. This is a really really dumb question.

2. Newbie: dumb question, very dumb....

3. Really dumb question about As

4. really dumb question

5. Really dumb question

6. A really dumb question... OS Detection

7. Really dumb question

8. dumb question: labels and textboxes alignment

9. Newbie dumb question - Creating Macros?

10. Dumb Newbie Question

11. A few dumb newbie questions...

12. Another Dumb Newbie Question :-)

 

 
Powered by phpBB® Forum Software