newline character

workmad3

***** Slob
Local time
Today, 02:20
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
 
Try appending chr(13) to your string : eg.

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

That should do the job!
 
:( 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.
 
Me.txtMyTextBox.Value = "line1" & vbCrLf & "line2"
 
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
 
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

Back
Top Bottom