Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 17974
Number of posts: 55343

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Displaying text on a form Posted by horsehead on 26 Jun 2005 at 1:42 AM
Hi everyone - this may seem to you all a very basic problem but I have spent hours scoring the texts to get an answer without success.

I want to display a value on a form in a text box for each iteration of some code such that I build up a list ie without overwriting on each iteration and for the life of me - I cant see how.
IE me.textbox2.text = "hello" say and me.textbox2.text = "how are you"
I want to see in the text box (or something similar) hello and on the next line how are you.

Help me please!!!!

Thank you
Report
Re: Displaying text on a form Posted by seancampbell on 26 Jun 2005 at 11:41 AM
: Hi everyone - this may seem to you all a very basic problem but I
: have spent hours scoring the texts to get an answer without success.

: I want to display a value on a form in a text box for each iteration
: of some code such that I build up a list ie without overwriting on
: each iteration and for the life of me - I cant see how.
: IE me.textbox2.text = "hello" say and me.textbox2.text = "how are
: you"
: I want to see in the text box (or something similar) hello and on
: the next line how are you.

: Help me please!!!!

: Thank you

Ok...
I do not know exactly what you are doing but this may help.
Make sure that your textbox has the option MultiLine set for true (Me.Text2.MultiLine = true) and this will work.

Everytime you add a new line of answer, do this:
Me.Text2.Text = Me.Text2.Text & vbCr & vbLf & "Your Text Here"

That will concatinate the answer onto the end of the string in your textbox and it will add in the Carrage return in between the old string and whats added on.

Hope that helps,
Sean
Report
Re: Displaying text on a form Posted by horsehead on 27 Jun 2005 at 1:42 AM
Thanks Sean this is along the lines of what I am after at least in the end result. Maybe it is not a textbox that I should be using though.
My program is writing a line of text each time it goes through a loop (could be 1000 times) and I want to show on my form one under the other the line of text. A text box seems the obvious way to do it but how - me.textbox1.text over writes what was there before.

Thanks again


Report
Re: Displaying text on a form Posted by infidel on 27 Jun 2005 at 12:04 PM
: Thanks Sean this is along the lines of what I am after at least in the end result. Maybe it is not a textbox that I should be using though.
: My program is writing a line of text each time it goes through a loop (could be 1000 times) and I want to show on my form one under the other the line of text. A text box seems the obvious way to do it but how - me.textbox1.text over writes what was there before.

Yes, but if you include me.textbox1.text in the new value like Sean said, your textbox will accumulate one line after another

me.textbox1.text = me.textbox1.text & vbCrLf & "new text"


infidel

$ select * from users where clue > 0
no rows returned


Report
Re: Displaying text on a form Posted by seancampbell on 27 Jun 2005 at 12:06 PM
vbCrLf, I didn't realize ever that that was a variable lol. I guess you learn something every day.

I always did it the longer way, vbCr&vbLf

Report
Re: Displaying text on a form Posted by horsehead on 27 Jun 2005 at 7:47 PM
Thanks fellas for the answer - I guess I misunderstood what Sean was saying.

Regards
Report
Re: Displaying text on a form Posted by BitByBit_Thor on 1 Jul 2005 at 1:46 PM
: Thanks fellas for the answer - I guess I misunderstood what Sean was saying.
:
: Regards
:

Though if you are correct about a thousand lines, it might become pretty annoying, no matter what control you use... Another problem to solve

Greets...
Richard




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.