Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic


the code for a new line is controlchars.newline. what is the equivelant in vb6?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Hi, I'm just wondering how can you make:

With objMailItem
.To = DataComboAssignedTo.Text
.Subject = "Test"
.Body = "Record Number: " + txtRecNo.Text + ", " & _
"Request Date: " + txtDate.Text + ", " & _
"Requested by: " + txtName.Text + ", " & _
"Problem/Request: " + txtProblem.Text + ""

.CC = ""
.Attachments.Add "Path"
End With

Set objMailItem = Nothing
Set objOutlook = Nothing

display like this when I view the message in OUTLOOK:

Record Number: 'whatever number * firstline
Request Date: 'Date Requested * newline
Requested by: 'your name * newline
Problem/Request: 'Description of the prob * newline

i have been searching through the site for a method to make a newline in a textbox.
eg. in a text file i have got
Reynolds Josh HIS GEO ENG MUS GST 03/04/85
Smith Diana FRE GER JAP
Johnson Sukwinder MAT PHY 23/06/85
i have made a button so that when it is clicked, it will read in the above lines into a textbox in VB6

But this is what appears
Johnson Sukwinder MAT PHY 23/06/85Smith Diana FRE GER JAPReynolds Josh HIS GEO ENG MUS GST 03/04/85

All three line are together in one line!

Can someone help please, i need some simple code that i can understand please.

thanks very much.


Im sorry for being so stupid, but how would i make a messagebox have 2 lines of text, like i want a message box that looks like ythis:

how are you?

with a LINE break. what is the linebreak character?

Trying To Get A Newline
I am using the shellexecute method to get the default mail client to open up a new message window. I've included the "TO" field, the "Subject" field, and the "body" field.

However, there's a problem with the body field. I can't get vbCrLf or chr(13) to work in it. Here's my code:

VB Code:
strbody = "Hi" & Chr(13) & "The library records show that you have issued the book number " & bookid & "." & Chr(13) & "I am in need of this book, so I request you to return it to the Library." & Chr(13) & Chr(13) & "Regards, " & Chr(13) & m_myuserid & Chr(13) strbookaction = "mailto:" & objrs.Fields(0).Value & "?subject=Request for Book&body=" & strbody ShellExecute hwnd, vbNullString, strbookaction, vbNullString, "C:", SW_SHOWNORMAL

Any suggestions?

Cannot Ignore Newline?
I'm having some issues when it cmes to reading a file and ignoring vbcrlf.
ii'm building a small intrepritive language type thing and it's not suposs to be line sensitive and it wont let me rid the Char as string of vbcrlf. I'm stumped.


' open above ...
Char = Input(1, FFile)
If Char = vbCrLf Then
Char = ""
End If
'close down here

Newline In String
I have a string with text which at some point I put in a textbox.
I want it to show on multiple lines in the textbox, but I want to decide where the newline should start when I put the text in the string, not when it's being put in the textbox. How would I do this? (Not sure, my question is clear, let me know if not)

Newline Using Msgbox
How do you create a new line of text when using the message box?

Newline Character

I am adding a catalogue in my microsoft access database (in access itself, not via a 3rd party program).
The field 'description' holds all information regarding the item, but how do include a 'newline'-character in my description? Does
suffice ?
When I load the description in a textbox, the newline should work.

Thank you!


Newline Character...
Hello again!

Does anyone know what the newline character is in VB?

For example, in C I could create a string "Hello
good morning" and the output would be

good morning"

What is the VB equivalent of the
newline charcter?

Many thanks!


Newline At End Of Form
is there a way i can tell my form that if i'm doing something like
For y = 1000 To 1 Step -2
Print "b"
Next y

That when the line of "b"s reach the end of the form to goto the next line, but not to go down until it has reached the very end of the form... like so

Is There A Newline Character In Vb?
I have a textbox (txtReport). TxtReport is for display purposes only. I have a string (report) which is supposed to be one report on one line but I cant get each report on a different line in the textbox.
I have tried using is txtReport.SelText = report & Chr$(13)
Does only one know a way to make this work? With or without the code above.

Newline In TextBox
How do I put newline in a text box?
Problem is, I want multi-line outputs in a textbox
a is 10
b is -56
c is 23

But when I use the following
Text5.SelStart = Len(Text5.Text)
Text5.SelText = "a is 10"
Text5.SelStart = Len(Text5.Text)
Text5.SelText = "b is -56"
it results in a long string of text, like
a is 10b is -56
and so on

Any help will be highly appreciated
Thanks in advance

Newline In MsgBox()
Does anyone know how to go to a new line in a message box? I tried this but it doesnt work:

Ln1 = "Note: Line1"
NewLine = ""
Ln2 = "Note: Line2"
NoteMsg = MsgBox(Ln1 & NewLine & Ln2, vbOKOnly)

NewLine Character
This is probably an easy question, but I haven't programmed in VB for almost a year, and I'm a bit rusty.

I'm looking for something (like vbCrLf) that will make a new line. The thing is with vbCrLf, it goes down 2 lines, and I need it to only go down one line. Can anybody help me?

For instance:
Text text
Text text text

But vbCrLf would do:
Text text

Text text text

I need the first one...

NewLine Symbol In Rtf

Not sure how to explain this so do this:

Add a listbox , 2 Rtb and a command button

make rtb multiline, then add text into it with lots of newlines . Now add the rtb text into the listbox and u will see that where there is a newline, there is a symbol which looks like | but only shorter and darker. Now add list1.text to the second rtb and u will see that the symbol is gone. How can i add that symbol to a rtfbox without it being changed into the newline?

Newline In Database

below is a function to save a persons account to the database pdata.dat.

can sombody show me a way to open the db and add UserDB(a).TEST to each of the player accounts stored in the pdata.dat, this would mean i wont have to reset all the players accounts so they dont lose thier stuff when it comes to me adding new features.

VB Code:
Public Sub SavePlayerData()Dim a As Integer Dim ff As Integer  For a = 1 To MaxUsers   If User(a).Status = "Playing" Then      UserDB(User(a).DataBaseID) = User(a)   End IfNext a ff = FreeFileOpen App.Path & "pdata.dat" For Output As ffFor a = 0 To UBound(UserDB)   If UserDB(a).UName <> "" And _      UserDB(a).UserGUID <> "" Then         Write #ff, UserDB(a).UName         Write #ff, UserDB(a).UPass         Write #ff, UserDB(a).UserGUID         Write #ff, UserDB(a).Purge         Write #ff, UserDB(a).Location         Write #ff, UserDB(a).HomeTown         Write #ff, UserDB(a).Killed         Write #ff, UserDB(a).HomeAbv         Write #ff, UserDB(a).Reputation         Write #ff, UserDB(a).Rank         Write #ff, UserDB(a).Kills         Write #ff, UserDB(a).Weapon         Write #ff, UserDB(a).Armor         Write #ff, UserDB(a).Ammo         Write #ff, UserDB(a).Cash         Write #ff, UserDB(a).Bank         Write #ff, UserDB(a).Accuracy         Write #ff, UserDB(a).Hiding         Write #ff, UserDB(a).Search         Write #ff, UserDB(a).Tracking         Write #ff, UserDB(a).Chemistry         Write #ff, UserDB(a).Bounty         Write #ff, UserDB(a).Pimping         Write #ff, UserDB(a).Snooping         Write #ff, UserDB(a).Stealing         Write #ff, UserDB(a).Health         Write #ff, UserDB(a).AccessLevel   End IfNext a Close ff End Sub

Newline Character
Hello Everybody,

I want to initialize an array with hundreds of data

StrArray = Array("ABC", "PQR, XYZ" , and so on)

More than 256 Characters are not allowed in one line. I get an error when I put data like this:

StrArray = Array(
and so on ...

Is there anyway to continue with same instruction in next line.


Is There A Newline Character?
Hello all,

I have a txt file with text that looks like this:


There are exactly 10000 words in this list with some words are 4 letters or more. I need to be able to put all words in a Access DB. The words with 4 letters or more will need to be split with the first 3 letters going to a column in the DB and the left over letters going to a different cloumn of the DB.

So for the word "nicht"

1st 3 letters

left over letters

They are delimited by I think newline characters
but I'm not sure of how to tell VB to look for them.
Also, how can I tell VB to split words that are 4 letters or longer?

Thanks for even reading all of this and for any help that you may be able to provide.


Newline In Text Box

i want to place different data at a newline in the text box.

i have tried these codes, but fail...

txt_dealer_add.Text = selected_dealer_address_street & vbNewLine & selected_dealer_address_unit & vbNewLine & selected_dealer_address_postal


txt_dealer_add.Text = selected_dealer_address_street & vbCrLf & selected_dealer_address_unit & vbCrLf & selected_dealer_address_postal



Newline In Textbox
I have a vb program im working on and i display a lot of records and junk in a textbox. My question is how the f do I tell the textbox to go to a newline without filling up the line im currently on. I have tried everything and its annoying. C has
why is vb so difficult?

thanx for da help

Newline Character(s)
Is it even remotely possible to change the character Textboxes use to identify the beginning of a new line? Instead of chr(13)-chr(10) for new lines and chr(13)-chr(13)-chr(10) for wordwraps I could set them to some arbitrary character strings?

Failing that, does anyone know of a control out there that will let me do that?

NewLine In TextBox
I have a TextBox with multiline property set to true. The text contained in this TextBox comprises of strings acquired from different fields in my database. I want to separate each of these strings by a 'NewLine' character so eash string comes on a new line. How do I do this?

I tried using SendKeys("{ENTER}") but it didnt work.

Newline Character
How do I insert a newline character in a string that has to be displayed for eg. in a textbox?

Newline Using API WriteFile
I need to insert newline at the end of a textfile using writefile.
Is this possible or are there another API-Call to do that?

/John Jacobson

The Search For Newline
Hi all,

This is a pretty retarded question, but for some reason I can't seem to get it.

I am searching for a newline character in a string. I do this:

tempNewline = InStr(1, sReadBuffer, "
", vbTextCompare)
If (tempNewline <> 0) Then
MsgBox ("NewLine")
End If

But this always returns 0. I also tried the vbBinaryCompare, but that didn't work either. Maybe my character for newline is not supposed to be "
"?? I have that newline character from C, but maybe it's different in VB.

Newline In Text Box
hi there,

Let me know please how to enter a newline in a text box whose multiline set
to true
Text2 = DataCombo3.Text
Text2.Text = NEWLINE & Combo1.Text
it is not working!
Any suggestions?

What Command If I Want Do Newline
i have for function in crystal report but i want if the number is printed goto new line and continue loop until finish
how can i do that
if can i want do in detail section
or any suggest for me ?

CDONTS Newline
Hi. I am sending the results of a form via email using CDONTS. I want to insert a newline between the values I have retrieved for readability. Is there a function for this? (I instinctively tried the C++ method of '
' but could not make it work. Thanks!

Jeff A. Moore
MCSE, MCP+Internet

Newline Character
I am using a function in an automation interface.

The function takes as an argument a string separated with newlines. Since there is no such thing as the "
" character in VB, I have tried using equivalents, such as vbCrLf , Chr$(13) & Chr$(10), etc. and none of these has worked so far.

Is there something that I can use in Visual Basic that will be recognized as the "
" character by the interface?

Problem With Email Newline
I am using a self-made ActiveX control to send email.

When it gets to the point during the SMTP transaction where it sends the message body I cant seem to get it to send newline characters properly.

e.g to send the data

winsock1.senddata( the string )

the string contains ->> line1 & vbcrlf & line2 & vbcrlf etc...

When i few the EMAIL SOURCE in OUTLOOK express, sure enough.. its shows up as..


but when reading the email it comes up as ->> line1 line2... without exectuing the newline characters...

what is going on?? can anyone help thanks in advance.

Newline In Column Header
Hi, Need help in this area...

.Col = 6
.RowHeight(0) = .Height / 2
.ColWidth(6) = .Width / 7
.CellFontSize = 10
.CellFontBold = True
.MergeCol(0) = "true"
.Text = "Total Moves" & vbCrLf & "(Offloading/Mounting)"

I wanted to create a newline in column header as to minimize the colomn width... I tried using vbCrLf and vbNewLine. But both did not work for me...

Any experts? Please kindly help! Thank you Thank you...

Auto Newline When End Of Textbox Lol
i finally done with ym encrypt and decrypt part.. but then i saw that al lthe text wil lgo in one line.. how do i set my text box up to newline when reachin the end of the textbox?

Vb(Cr, Lf, CrLf, NewLine) Constants
Does anyone have a good explanation on the differences between vbCr, vbLf, vbCrLf, and vbNewLine? What I mean is, when would you use one over the others? Thanks in advance!

Isnull And Newline Problem

I have two MS-Access databases, and I need to import DB1 into DB2. I'm writing a script to do this (there are some lines in DB2 that already exists in DB1, so I may not import those lines, that's why ).

Now, I read my first line into a ADO-recordset. The "comments" field is type memo . Every time when I put this field into a variable, for example "sComment", it puts it into this var, but the next time the field "comments" is accessed, I get a NULL value, without moving to the next recordset. I don't get it, can anyone help me? It goes wrong when I perform:
sComment = iif(isNull(rs.fields("comments"))," ",rs.fields("comments"));
The next time, rs.fields is NULL...

Also, when I insert a value from the memofield, I receive an error. In some fields, there are newlines entered. How can I solve this?

This is my code:

dim cn As ADODB.Connection, cnBack As ADODB.Connection
Dim rs As New ADODB.Recordset, rsBack As New ADODB.Recordset
Dim adoCMD As New ADODB.Command, sComment As String

Set cn = New ADODB.Connection
cn.ConnectionString = "Driver=Microsoft Access Driver (*.mdb);DBQ=" & sDBlocatie
Set cnBack = New ADODB.Connection
cnBack.ConnectionString = "Driver=Microsoft Access Driver (*.mdb);DBQ=" & sDBlocatieBack

Open "c: est.txt" For Output As #1
rs.Open "SELECT * FROM tblHeader ORDER BY headerID", cn, adOpenForwardOnly, adLockOptimistic
'rij per rij afgaan of deze ook voorkomt in de backup-db
While (Not rs.EOF)
Debug.Print "comment = " & rs.Fields("comments")
'value = line 1
' line 2
Debug.Print "headerID = " & rs.Fields("headerID")
sComment = iif(isnull(rs.fields("comments")), " ",rs.fields("comments"))
'value is NULL!!!
rsBack.Open "SELECT headerID FROM tblHeader WHERE clientID=" & rs.Fields("clientID") & " AND varietyID=" & rs.Fields("varietyID") & " AND vesselID=" & rs.Fields("vesselID") & _
" AND headDate=#" & rs.Fields("headDate") & "# AND originID=" & rs.Fields("originID") & " AND supplierID=" & rs.Fields("supplierID") & " AND cold_storeID=" & rs.Fields("cold_storeID") & _
" AND stationID=" & rs.Fields("stationID") & " AND inspectorID=" & rs.Fields("inspectorID") & " AND temp_cold_store='" & rs.Fields("temp_cold_store") & "' AND comments='" & sCommentaar & "'", cnBack, adOpenForwardOnly, adLockOptimistic
'" AND calcAvg='" & rs.Fields("calcAvg") & "' AND boxes='" & IIf(IsNull(rs.Fields("boxes")), "0", rs.Fields("boxes")) & "' AND contnr='" & IIf(IsNull(rs.Fields("contnr")), " ", rs.Fields("contnr")) & "' AND ref_nr='" & IIf(IsNull(rs.Fields("ref_nr")), " ", rs.Fields("ref_nr")) & "' AND headRemarks='" & IIf(IsNull(rs.Fields("headRemarks")), " ", Replace(rs.Fields("headRemarks"), "'", "''")) & "'", cnBack, adOpenForwardOnly, adLockOptimistic
If (rsBack.BOF And rsBack.EOF) Then
'insert new row
Print #1, "insert " & rs.Fields("headerID")
End If
Close #1

Textbox, Multiline, Newline
I want to beable to modify the text1.text so each time I 'enter' something it goes on a newline something like.

Text1.text = Text1.text & newline & "Hello"

So if text1.text said

After using that it would say.


Print Command Always Does Newline
Hi All -

I'm just writing a little program to convert a csv file into a html file. Works fine except that each time i'm using print it is putting the character on a new line - so it is creating ugly html files.

Would appreciated any advice on how to suppress the newline.



Dim str_comma As String
Dim strcomparing As String
Dim int1 As Integer
Dim firstrun As Boolean
Dim x As Long
Dim sTemp As String

'Set varible value
firstrun = True
str_comma = ","

'Open files for read and write
Open App.Path & "premiumstock.html" For Output As #1
Open App.Path & "stock.csv" For Input As #2

While Not EOF(2)
Line Input #2, sTemp

If firstrun = True Then
Print #1, "<font face=""Tahoma"" size=""1"">"
Print #1, "<div align=""right""> <table border=""1"" cellspacing=""1"">" 'width=""100%""
Print #1, "<tr>"
Print #1, "</tr> <tr>"
End If
Print #1, "<td width=""7.14%"">"

For x = 1 To Len(sTemp)
strcomparing = Mid$(sTemp, x, 1)
int1 = StrComp(strcomparing, str_comma, 1)

If strcomparing <> str_comma Then
Print #1, strcomparing
End If

If int1 = 0 Then
Print #1, "</td>"
Print #1, "<td>"
End If

firstrun = False 'change condition to end tables correctly
Print #1, "</tr>"

Close #1
Close #2


Net Send NEWLINE Or CRLF &lt;BR&gt; ?
How do I get a new line in the message string when using net send? I want more than one line displayed in the popup.

I cannot send a file that already has newlines because of file permissions.

Removing Newline Character Help!
what code can i use to remove the newline character from a rich text box. (VB .NET)

Newline In A Multiline Textbox
How do you put a newline in a MULTILINE textbox?

Newline In Tooltip Text
Is there any way of introducing a newline in a tooltip text.
In other words how is a multi line tooltip text implemented. I tried concatinating chr(13) between the texts but it does not help.


Making A NEWLINE In A Textbox? How Do I Do It?
I have some variables i would like to put in a textbox, for example when the user types in something to another textbox it stores a variable and when you click a button the text displays something like this...

text1.text "This is a variable " & myvar

I want to be able to put a newline tag or something in there like this...

text1.text "This is my" & newline & "variable " & myvar

something to that nature.. if anyone could help i would really appreciate it.. someone else told me that it can be done with the CHR() tag??? PLZ HELP

- azpc

How To Add Newline Character Into A String?
What is the method to add newline character to a string (like a "
" in C)? When I load the string into the textbox, will the newline be visible.

Also, is there a way to have scroll bars (both horizontal and vertical) for Listboxes?

Happy New Year,

SQL/Access - Newline Woes
The ASP pages (VB script) on my website routinely use SQL commands to retrieve large multiline textual data from the memo field in my Access database and display them. The only problem is when I try to get the pages to accept multiline text from a form and insert it into the same memo field on my database. It simply doesnt work, possibly because on encountering the first newline character in my string, the database thinks it signals the end of the SQL command!!

Is there a turnaround?

Display NewLine In Textbox
I have tried to display multi-line in a textbox by a string..
abc = "firstline"+chr(13)+"secondline"
textbox.text = abc

but it doesn't display in different line.
is it there special charactor to show newline and what is it??

Newline In Excel Cell Formula
Greetz all,
I am trying to write some code that will combine the values of a number of cells into one cell, with each value on its own line. Eg:
A | B | C | D
Frank | 20 | 60 | Person: Frank
| | | Time: 20m
| | | Cost: 60

I have tried using VbCrlf and Chr(10) but neither seem to work, both just add an unrecognised character (square symbol) into the cell and do not insert a new line.

Any ideas?


Delete Newline Or Carriagereturn From String
Hi there
i have a text file produced in Unix system.
this file has about 50000 lines of 20 characters, beeing the 20 charecter a newline or a carriage return.
the problem is that the last line must not have that 20 character. it must have only the 19 characters.
sometimes this file has that character in the last line, and i need to find if it's there, and if it is, delete it.
I have tryed everything with this code

open "c: est.txt" for input as #1
do until EOF(1)
line input #1, temp
close #1
s = instr(1,temp,chr(13),vbtextcompare)
msgbox s

this is just to verify if a carriage return exists in the last line
i tryed it with chr(13),chr(10),vbcrlf
it doesn't find it, but i know it's there, since the destination aplication that
will use the file, does find it, and displays a warning message.

when i open the file with notepad, it has a blank line with zero-lenght
in the end, so i know that character is there.

i'm locked, don't know what else to do.

thanks for any help

Richtextbox - Auto-newline After Pictures

im making a chat. sofar im just concentrating on making smielys works so the chat is 1 on 1 (irrelevant).

here is the relevant code (about 15 lines)

Private Sub Form_Load()
'smiley_glad is a richtextbox (its invisible to the user) read the PS at the bottom of this post to understand why i do this
smiley_glad.OLEObjects.Add , , "C:Documents and SettingsAlexMy DocumentsMy Picturesmsn6 rillsmileysmps=D.bmp"
End Sub

'following is the end of the listen/wait4connection button sub
'rtbin is the richtextbox where the chat is shown. the following two lines will during program run show my problem (newline after :D)
addtext "*** Waiting for Connection :D ***", rtbin, vbBlue
addtext "*** Smileys almost works :D ***", rtbin, &H8000& ' Darkgreen
end sub

Private Sub addtext(ByVal Text As String, ByRef rtb As RichTextBox, Color As Long)
rtb.SelStart = Len(rtb.TextRTF)
rtb.SelColor = Color
rtb.SelText = Text & vbCrLf
rtb.TextRTF = Replace(rtb.TextRTF, ":D", smiley_glad)
End Sub

here is a pic of the results when the prog is running and u clicked listen..

as u can see on the above pict something is automatically causing/putting newlines after each smiley. Note that this is ONLY when the replace of :D to smiley_glad is used.. if i uncomment that and thereby turn of smileysupport then there is no new lines automatically after the ":D"'s.. so its only when i have pics..

PS: the reason i dont use oleobject add in the add text sub is that it takes a half sec for every smiley to load.. thats why i load this testsmiley at form load, into an invisible rtb (smiley_glad) and then i use its contents, as seen above, when i need that smiley.

Writing To Textfile With Newline And Reading

Did a long search, but I just can't make it work. Im trying to write 3 color-values into a textfile.

1) How do I write to the next line within a textfile? I can't make the EOF work.
2) How do I read the first line to a textbox, the second line to another one, and so on.

Or perhaps there is a much better way.

Reading code:

Dim lngBkClr As Long
If Dir$(App.Path & "LibTest.txt") <> vbNullString Then
Open App.Path & "LibTest.txt" For Input As #1
lngBkClr = Input(LOF(1), 1)
Text1.text = lngBkClr
Text2.text = lngBkClr
Text3.text = lngBkClr
Close #1
End If

Writing code:

Open App.Path & "LibTest.txt" For Output As #1
Print #1, Commondialog1.Cloor
' Replace the first line or the 2nd or the 3rd
Close #1

How To Split Column Heading With Newline

Does anyone know how to break a column heading (eg, in a listview, listbox, etc) into multiple lines (not rows)? For example, a column heading might look like:

Description | Product Code | etc

and after breaking:

Description | Product | etc

Ie, I need to insert a newline in the text - doing that however only prints a little ascii square and does not do as expected.

Sorry, I know this is trivial, but I cannot figure it out. Searching the web has been fruitless.


Copyright 2005-08, All rights reserved