newline character (1 Viewer)

workmad3

***** Slob
Local time
Today, 12:07
Joined
Jul 15, 2005
Messages
375
ok, ive been looking and looking every where for this, and cant find it :(

what can i put in a string that will tell a textbox to put it on a newline?

i.e.

Dim line as String

line = "such and such <want a new line character here and so on>"

so that it would output as:

such and such
and so on

any help would be appreciated
 

GUIDO22

Registered User.
Local time
Today, 12:07
Joined
Nov 2, 2003
Messages
515
Try appending chr(13) to your string : eg.

"a string " & Chr(13) & " more string...."

That should do the job!
 

workmad3

***** Slob
Local time
Today, 12:07
Joined
Jul 15, 2005
Messages
375
:( it doesnt seem to be working. It leaves a black line for an unknown character instead. I think on the right lines though, just need to get the right character code.
 

john471

Registered User.
Local time
Today, 21:07
Joined
Sep 10, 2004
Messages
392
Me.txtMyTextBox.Value = "line1" & vbCrLf & "line2"
 

workmad3

***** Slob
Local time
Today, 12:07
Joined
Jul 15, 2005
Messages
375
yay :D works perfectly now, thanks for all the help

wish it was better documented (or easier to search) how 2 get the newline char in vb
 

Jack Skeleton

Selfmade Accessman
Local time
Today, 04:07
Joined
Aug 3, 2005
Messages
29
Another way to do the same (not exactly, but...)

The right answer for your question has been already given, but maybe you don't know this option:
In the design view of a form, see the properties of the textbox. In "Others" you'll find the property "EnterKeyBehavior". Changing this property you change the way the ENTER Key works in the textbox... you can change it to "new line in the field" (guess what it does...).
Did you know it?.
 
Last edited:

Users who are viewing this thread

Top Bottom