Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Can a single print command print a block of text?

Author
Message
Boo
20
Years of Service
User Offline
Joined: 29th Feb 2004
Location:
Posted: 16th Mar 2004 04:28
Instead of using multiple print commands, how can one print command print a block of data such as . . . print data$, with data$ consisting of multiple lines of text. Doing this implies automatic text wrapping, line width would probably be specified, etc.

thanks for your comments.
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 16th Mar 2004 05:03
Yes, you can print blocks of text. To do so, you need to include a line feed character.

print "text 1"+chr$(10)+"text 2"
wait key

--
TAZ

Boo
20
Years of Service
User Offline
Joined: 29th Feb 2004
Location:
Posted: 17th Mar 2004 16:00
Thanks. It works if "text" is used. How about data variables as listed in the code below?
Boo
20
Years of Service
User Offline
Joined: 29th Feb 2004
Location:
Posted: 17th Mar 2004 16:04
Whoops. Somehow I didn't get the code below included in my previous response.


print text1$+chr$(10)+Text2$
wait key
text1$="hello there, this is a test to determine what happens here"
Text2$=" And what happens here"
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 17th Mar 2004 18:00
Yes, you did. See the SOURCE button on your tool bar? Click it and be amazed.

Just for stupid sake, you do know that basic is read and EXECUTED from top to bottom?

Try this instead:

text1$="hello there, this is a test to determine what happens here"
Text2$=" And what happens here"
print text1$+chr$(10)+Text2$
wait key

jasuk70
21
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 17th Mar 2004 19:04
I think you'll need to write your own wordwrap routine or look for any that may be in the code snippets.

Jas

----
Http://www.jsun.co.uk
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 17th Mar 2004 19:14
He's not ready for font width and height calculations yet. Give him some time.
--
TAZ

Boo
20
Years of Service
User Offline
Joined: 29th Feb 2004
Location:
Posted: 18th Mar 2004 04:06
Thanks Jas and TAZ.

I guess that I could have also:

Print text1$;text2$

Sorry, but I don't see a "Source" button on my toolbar. I'll reread the newbies "how to section".
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 18th Mar 2004 04:22



Home of the VB.NET Class Builder Utility - Demo available now!
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 18th Mar 2004 17:24
The forum 'tool bar' is at the end of every post and includes links to your profile, home page, e-mail, instant messages, etc.

This forum DOES NOT EDIT YOUR BROWSER'S TOOL BAR. Sorry if I wasn't too clear and you didn't see the all the buttons with the yellow pyramid that say, 'source'.
--
TAZ

Boo
20
Years of Service
User Offline
Joined: 29th Feb 2004
Location:
Posted: 18th Mar 2004 19:50
Thanks, TAZ.

I'll soon be gaining more experience, with fewer dumb questions.

The tuts I've found on this site have been very helpful, as have you.
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 18th Mar 2004 21:39
Thanks, I sometimes play the grumpy old man, but I try to be helpful. There's no such thing as a dumb question, so don't be shy about posting. The worst that can happen is someone points out the obvious. And, that's a lot better than banging your skull on the keyboard.
--
TAZ

KC27
20
Years of Service
User Offline
Joined: 18th Mar 2004
Location:
Posted: 18th Mar 2004 22:15
I am just curious, I have had DBC for 3 years, and I have never used the CHR$() command, can someone tell me how to use it??

Subdivision of LSGaming
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 18th Mar 2004 22:29
The CHR$() command takes ACII character codes and spits out the string equivalent. Examples (from memory):

10 line feed
32 space
34 double quote (handy if you want to add them to a string)
48 zero
65 A
96 a
--
TAZ

KC27
20
Years of Service
User Offline
Joined: 18th Mar 2004
Location:
Posted: 18th Mar 2004 22:50
Thanks zircher

Subdivision of LSGaming

Login to post a reply

Server time is: 2024-09-22 02:36:04
Your offset time is: 2024-09-22 02:36:04