By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,695 Members | 1,221 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,695 IT Pros & Developers. It's quick & easy.

How to make longest string into more rows in printDocument?

P: n/a
Hi All,

I want to make the longest string value (it probables more
than 300 words.) to more rows to print it using
printDocument.

How do i do it like WORD that it auto cut string value at
space character.
Nov 20 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Nak
> I want to make the longest string value (it probables more
than 300 words.) to more rows to print it using
printDocument.

How do i do it like WORD that it auto cut string value at
space character.


Hi there,

I'm not quite sure that I understand what you are after. A string
doesn't get *cut*, it contains characters to make a new line, space etc.
these characters are used in visual basic by using constants. What are you
displaying the string in? a text box? a rich text box? Try the following to
add a new line to a string...

Dim mystring as string = "This is a string." & ControlChars.CrLf & "This is
on the next line"

The only reason you actually get new lines, spaces etc is down to the
contol that your putting the string into, in essence a string is simply a
load of values joined together, for ASCII the values are bytes in the range
of 0 to 255. Look up "Print and display constants" in the documentation :-)

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #2

P: n/a
Cor
Hi Kwok,
I don't understand this, will you explain something more what you mean with
this?
How do i do it like WORD that it auto cut string value at
space character.

Cor
Nov 20 '05 #3

P: n/a
Hi Guys,

Kwok wants to do word-wrap of paragraphs stored in a single string.

I'm too tired to explain about (harder method) measuring strings in a
given font that will match the printer, or (easier method) counting characters
and then finding the nearest space or other word-break character.

G'night,
Fergus
Nov 20 '05 #4

P: n/a
"Kwok" <k_*****@hotmail.com> schrieb

I want to make the longest string value (it probables more
than 300 words.) to more rows to print it using
printDocument.

How do i do it like WORD that it auto cut string value at
space character.


Use the version of DrawString that takes a Layout-Rectangle. Example:

Graphics.DrawString(<myString>, Me.Font, Brushes.Black, New RectangleF(0, 0,
150, 500))
--
Armin

Nov 20 '05 #5

P: n/a
Nak
> Give Nick, Fergus and Herfried a nice item and you got the longest strings
of the world.


LOL

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #6

P: n/a

Hi Armin,

Thanks a lot.

Kwok

Use the version of DrawString that takes a Layout- Rectangle. Example:
Graphics.DrawString(<myString>, Me.Font, Brushes.Black, New RectangleF(0, 0,150, 500))
--
Armin

.

Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.