Joining A String Which Is Split By Carriage Return Line Feed
I'm stuck in a situation now..I hope someone out there can help get me out of it...here's the situation:
I now have a string as follows:
how am I able to join all the strings to form a string
i.e. delete off the carriage return line feed
Thanks in advance!
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Carriage Return And Line Feed
I'd like to know how to insert a carriage return and line feed on a frmDisplay from frmMain. This is my code to insert carriage return and line feed. frmDisplay contains txtDatalog.
.txtDatalog.Text = .txtDatalog.Text & "IFR Datalog for DUT " & k & Chr$(13) & Chr$(10)
.txtDatalog.Text = .txtDatalog.Text & DLogStr(k)
by the way, DLogStr(k) is a string that contains Chr$(13) & Chr$(10) at the end of each line.
Carriage Return + Line Feed
I am writing to one text file, the only problem is that everytime i save i have data that is overwritten in the text file each time i save.
Private Sub Command1_Click() Dim File As Integer File = FreeFile Open "C:Documents and SettingsCarlDesktopToo AddDD est.txt" For Output As #File Print #Handle, Text1.Text Close #Handle End Sub
How can i adapt this code to add a new line each time i save to it.
Line Feed && Carriage Return
I’m reading from one file where its text has a line feed character in the middle of it. When the text gets to the output file, I find a line feed AND a carriage return. Normally this wouldn’t be a problem but the text contains PCL (Printer Control Language) code. The carriage return is causing a problem when the output file is printed. The only functions that I perform on the text are mid and trim, which are no where near the line feed. Any ideas on how I could be picking up the carriage return and how to stop it from happening?
Carriage Return/line Feed Character(Hex #0A And Hex #0D)
I am writing contents in a text file using File System Object like this
tso.WriteLine "FIRST LINE"
tso.WriteLine "SECOND LINE"
I am sending this file to some one who is one Unix/Linux server and problem is it is not properly reading carriage return/line feed character. I got a response from them that the CR/LF character in my file is actualy Hex #0A and it should have been Hex #0D!!
I sent the file again this time using a little bit different code as follows:
tso.Write "FIRST LINE" & vbCrlf
tso.Write "SECOND LINE" & vbCrlf
But this doesn't work either as they have told me. How do I make sure I use Hex #0D instead of Hex #0A in VB6/vbscript?
Carriage Return And Line Feed Guitar Notation
I am trying to write a program that will insert the guitar chord above the text where it is to be played i.e.
A c# B
Guess who just got back today them wild
The problem is, I want to be able to type all the words in the song then set the cursor on say the t in just(see above line) and right click which will bring up a menu that I can pick the chord from (this I can do) but when I insert, it puts the carriage return in and inserts the c# at the beginning of the line. Any ideas on how to keep the location for the insert? Once the carriage return is done on a particular line then all I would need to do is insert at and above current cursor location.
Thanks in advance
Customer Suport Software Analyst
Replace Carriage Return / Line Feed In MS Access Table
I have a table with a memo field that contains a unique character (set of characters, actually: "|||") that I need to replace with a carriage return/line feed.
The search and replace utility within Access will not let me use special characters (will it?), and I cannot import the text without it spitting in that funky (r) character in place of the existing carriage returns.
I thought there might be either an easy way to do this, or a function that can be written that will search through the contents of a field in all records of a table and replace the "|||" with a Chr(10)+Chr(13).
Any advice is greatly appreciated.
Next Line (Carriage Return/Line Feed)
I used to make programs, then stopped. However, I needed to make a program to help me with something I've recently tried doing with pen and papaer and have learned that just won't do, haha
Anyway, I found the coding for an old program I made in 2003 with VB 4.0
I now have VB 6.0, and have used my old program as a huge stepping stone because it had much of what I needed already done.
Basically, the program I'm needing to make it to store some info into a file, then have it recall it, search and so forth.
Here's my question though. So that I can have it better organized, when I recall the info, I want each piece of info to be on another line (it's being viewed in a text box). Such as:
and so forth.
It's written to the file, with "|" (or ansi value 124) separating each piece of info. I figured that I could just recall it and when I want to view the info, I can replace the "|" with the "chr(13)" and "chr(10)". Here is the portion of the code I figured would do the trick . . . but it's not working out. Can anyone tell me if something is wrong with the coding below (or if you need more of the coding, let me know)? I know I can easily have it write the line breaks into the file and just recall it and it'll work, but I'd rather see about it this way . . .
Please bare in mind that I stopped making programs 4 years ago, and was then using vb4 and am now using vb6. I'm not fully brushed up on programming, so I am a bit of a novice again. Any and all help is appreciated, Thanks!
Here is what I thought would work . . .
Do While i < UBound(VScripture)i = i + 1 If Scripture = Left(VScripture(i), LookFor) Then c = 1 'Replacing the | with a Carriage return, and line feed, to put it on a new line Do While c <= Len(Trim(VScripture(i))) char = Mid(VScripture(i), c, 1) If char = Chr(124) Then char = Chr(13) & Chr(10) End If c = c + 1 Loop 'End Replacement TxtNotes.Text = TxtNotes & Chr(13) & Chr(10) & VScripture(i) & Chr(13) & Chr(10) End IfLoop
Please forgive me for my ignorance, but I really would love to have some help with this. Also, if there's an easier, shorter way (newer coding for vb6?) that would do the trick, please let me know . . . so long as it's explained fully to me and isn't so far fetched that I would get lost in it.
Thank you, again, for your help! I patiently wait for your replies!
Split A String By Carriage Return
I'm reading in a file a line at a time, and am running into difficulties splitting it into its components. I'm pretty sure it's delimited by carriage returns (Enter) but the couple ways I've tried to split it don't seem to work.
The delimiter when the file is opened in notepad is a square.
Does anyone know the method I can split this string into its pieces?
Help With Carriage Retrun And Line Feed Characters
I'm using Visual Basic 5.0 which I know doesn't have the Replace
Function ability. I have a user form with 12 textboxes that can have
multiple lines of data in each textbox, which I then send each boxes
data to it's appropriate DOCVARIABLE in a Word doc. When I open the
Word doc I see little square boxes representing carriage return or
line-feed characters, I'm not sure which ones they are. What's a good
way to get rid of the all the carriage return or line-feed characters,
so they don't appear in the Word doc.? And, the second part of my
question is when I retrieve the DOCVARIABLE data from the Word doc and
send it back to its appropriate textbox in the userform, it displays a
"|" (pipe symbol in UNIX) wherever the carriage or linefeed character
was in the textbox. So, what's a good way to get rid of that symbol??
Basically, I'm sending data from textboxes on a userform to
DOCVARIABLES in a Word doc. and then back. I'm using the Word doc.
DOCVARIABLES to store information that's updated numerous times in a
day using the userform. I hope someone can help me with this problem.
MsgBox Showing All Multi-line Footnotes That Have Carriage Return At End Of Line
Can I tell Word via VBA to show me all the footnotes that erroneously
have a carriage return at the end of multi-line footnotes. ?
To be more specific there are still people who press enter at the end
of a written line instead of let Word do the line break
The MsgBox should say for example:
Footnote 1: carriage return, page 7
Footnote 2: carriage return, page 9
Could please somebody give me a hint ? Thank you very much in
End Of Line And Carriage Return
I am reading data from a .csv file into a text box. In the textbox columns are seperated by commas but the rows are seperated by a character that I do not recognize-it looks like two pipe symbols "||". I think it may be a carriage return or end of line symbol. I want to search this string for a particular instance of this character but I don't even know what the char is and I can't copy and paste it from my text box to my Instr() function as it only advances the cursor to the next line when I do. Does any one know what the correct syntax for this character?
Carrage Return - Line Feed Question
I am having a problem with end of line character
the file that is being sent from me is being ftp to one of my unix servers
I then read the file in VB script (below) which allows printing of selected drawings
i have to run a command ux2dos on the unix side to be able to use the file
once i run this command i am able to use the file
it looks like it is putting ^M at the end of each line and a ^Z at the end of file
i think the ^M is a carriage return and ^Z is end of file
maybe the way I am reading the file in is not correct
any ideas would be helpful
Private Sub searchinterplant()
Dim vitemtofind As Variant
Dim vsearchval As Variant
Dim vdrwtofind As Variant
Dim testfile As String
Dim xxfile As String
Dim i As Integer
Dim xfile As Integer
Dim name As String
Dim strpartnum As String
Dim strPartNumber As String
Dim strPartNumbernew As String
Dim strDescription As String
Dim strDescriptionnew As String
Dim strdesc As String
Dim strtmp As String
Dim strqty As String
Dim strqtynew As String
Dim strquanity As String
Dim strVerRev As String
Dim strStatus As String
ListView1.View = lvwReport
'arone = ListBox1.ListCount - 1
Dim itmX As ListItem
Dim itmY As ListItem
Dim itmval1 As Variant
Dim itmval2 As Variant
Dim PauseTime, Start, Finish, TotalTime
Dim myarray(100, 50)
Dim arySplit As Variant
Dim aryBlankSplit As Variant
Dim strYourString As String
Dim strRet As String
Dim regePart As String
Dim regeDescr As String
Dim strString As String
Dim varPart As Variant
Dim varDescr As Variant
i = ListView1.ListItems.Count + 1
xfile = FreeFile
On Error GoTo err
'sonum = Text1.Text
'Dim ordernumstrArray() As String
'Dim ordernumstrSplit As String: ordernumstrSplit = sonum
'ordernumstrArray = Split(ordernumstrSplit, "-")
'num1 = ordernumstrArray(0)
'num2 = ordernumstrArray(1)
'num3 = Right(num1, 1)
'programsonum = num1 + num2
Open "Y:" + Text1.Text For Input As #xfile
'Load integer values MyArray
Dim strArray() As String
Dim tmpstrarray() As String
Dim tmppstrarray() As String
Dim partdescarray() As String
Dim rbarray() As String
While Not EOF(xfile)
' Obtain the data line
Line Input #xfile, name '<=CHANGED
strArray = Split(name, " ")
'tmpline = stripextrachars(strArray(1), Chr$(32))
'partdesc = stripextrachars(strArray(1), Chr$(32))
rbarray = Split(tmpline, " ")
'dwgsize = rbarray(0)
partnumber = strArray(0)
'qty = rbarray(2)
'linetotal = UBound(rbarray)
'For i = 3 To linetotal
'partdesc = Mid(partdesc, InStr(1, partdesc, " ") + 1)
'partdes = partdes + rbarray(i) + " "
Set itmX = ListView1.ListItems.Add(, , partnumber)
' Then generate its sub-items
itmX.SubItems(1) = qty
itmX.SubItems(2) = partdes
'itmX.SubItems(3) = strStatus
partdes = ""
For x = 1 To ListView1.ListItems.Count
ListView1.ListItems(x).Checked = True
Carriage Return In A Multi-line Textbox
I'm feeding the contents of arrays one by one into a text box. After the first element of each array has been entered into the text box, I add the 2 element of each array on a new line. It's not the entering of the data that's the problem; that's easy (of course). I don't know the command for a return (next line). I know that 'vbNewLine' is a way of inserting a new line when entering text in such a way, but if I do this and then move on to entering the next data, will the carriage return remain? I've seen other ways of entering a new line but I can't remember them, nor can I find them.
Carriage Return In Multi Line Text Box
Can anyone PLEASE help me with this problem :
I have a multi line text box in a form that I am trying to fill with information programatically.
I am putting the contents of various database fields for customr name and address into the text box and I want a RETURN between each line.
I am creating a string like this at the moment :
But when I assign the .Text property of the text box to this string it all appears on one line !
By the way, I also want to do the same to a Memo field in an Access database.
Any ideas ?
Code Carriage Return In Mult-Line Textbox
I have a multi-line Textbox setup that I am trying to add an address to through by code, however I cannot seem to enter correctly. Can someone please hlp, this is what I tried. Thanks!
txtMail = Recipient + vbCr + rsSpouse!StreetAddress + vbCr + rsSpouse!City + ", " + rsSpouse!State + " " + rsSpouse!ZipCode
Carriage Return In A String!
I know this is an easy question but... In a string how do you insert a carriage return or new line character??? I know it is a VB constant but I don't know which one. I am using it in a message box to move down to the next line.
String Concatenation With Carriage Return
I'm new to this forum and new to VB. I'm trying to concatenate some strings and put the resulting string into an ActiveX textbox component within an Excel spreadsheet. I can do this with regular characters but how to do this with the carriage return?
finalString = "This is sentence one<carriage return>" & "Next string"
How do I represent the carriage return in the above code? I know its ANSI code is "13" but not how to include the "13" into the above code segment.
Check String For Carriage Return
I want to read in the value of a string for comparison purposes that has been passed from an excel(cell) through VBA. When the value is read into a string variable, some of them contain, carriage return characters(A square box). how can I determine the ascii character value of the carriage return? I attempted to read the chr(13) value, but this did not do want i needed.
Here is what i have so far:
Dim i As Integer
Dim sectionHolder As String
i = 1
Do Until i = Len(sectionName) + 1
If Mid(sectionName, i, 1) <> Chr(13) Then
sectionHolder = sectionHolder + Mid(sectionName, i, 1)
i = i + 1
Converting A Particular Character In A String To A Carriage Return?
I am trying to read records from a text file as strings, and wherever there is a "~" in the original record, convert it to a carriage return/line feed, then write the new record to a new file. Does anyone know how I can accomplish this?
"Remember, no matter where you go... there you are."
- Buckaroo Banzai
Edited by - zigwaffle on 9/10/2004 11:14:07 AM
Word FormField Find Delete Last Carriage Return In String
Hi i have a word form and i want to run a macro on exit which will look at the string and delete the last vbCr. I'm then splitting the string by vbCr so i need the rest to stay in, but i need to validate the number of items once split having a carriage return on the end means there are more items in the string then the user thinks?
Was trying this but nothings happening:-
vQuantity = ActiveDocument.FormFields("txt_quantity").Result
vQuantity = Left$(vQuantity, Len(vQuantity) - 1)
Search String For Line Feed Or EOF Character...
Here's the problem. Often times I receive a text file or Excel file that has fields within a record, that have what appears to be a black box. This is usually treated as a line feed or (and in most cases) it tells my program that this is the end of the file, stop here.
Is there a way that I can look for this character or characters in my string and remove it if it isn't actually at the end of record, assuming of course that I know the position of the last character? I'm aware of vbCrLf, However, if I try an instr or strcomp command, it doesn't seem to have the ability to search the string and replace the character with "". What information is available on this? I've heard of a way that maybe I can read the input as binary and do something with it that way, but I haven't found any examples of this.
Any help is appreciated.
String Operating, Adding Line Feed After Certain Number Of Characters
How do i add chr(10) in a long string maybe after 50 characters?
because now in my excel sheet, some cells is extracted from db
with long "comments"..So the cells appends so long
so how do i cut the string into segments of maybe 80characters in
So maybe lets say a string has 100 characters, it will insert chr(10)
after it counts 80 characters and then combine it with the remaining
20 characters ..any idea?
Reverse Form Feed/line Feed In Dot Matrix Printers
is it possible to do reverse line feed printing/form feed in vb, like it should be down then across.
i need to print the contents down at first by completing the page the printer has to reversed at begining of the page, if it is possible lot replies will be helpful
Text File "carriage Return At End Of Every Line"
i have written a program which dloads data from a website and saves it to a text file. now a problem is i need to have that data on seprate line and the text file has a box like seprator at end of each line
how do i make my program identify the box as a end of line and put the data on seprate line
im attaching the output text file here with the post
Oposit Of Split() And Removing Return From String?
First off let me start with what content i am dealing with.
HKEY_CURRENT_USER, "SoftwareFrozen Ice BlueAdvanced Timer GoldConfig", "Minutes"
is the inputed reg key we are working with its content is.
I split this content and put it in a text box. its output lokos like
and so on
Allright for the problems.
My split() and place into text box works but it adds a return at the very end that dosent need to be there. here is my code
Private Sub Load_Click()
On Error Resume Next
Dim StringArray() As String 'array of strings
Dim s As String 'single string
Dim i As Integer
Dim m As String
s = regQuery_A_Key(HKEY_CURRENT_USER, "SoftwareFrozen Ice BlueAdvanced Timer GoldConfig", "Minutes")
StringArray = Split(s, "-") 'split string up by -
For i = LBound(StringArray) To UBound(StringArray)
m = m & StringArray(i) & vbCrLf
Text1.Text = m
Ok we see m = m & StringArray(i) & vbCrLf and you say DUHH & vbCrLf
but we know we need this to add a return from each splut to display the text as needed. so after we split this i put it into a string. I need to remove that blank return from the string nad hten palce it in the text box.
After we fix this the current ishue is. Geting the Text box data back to 1-2-3
Ok it works like this the user changes the text in the text box to.
I need to take the text boxes new data make it into a string that now looks like
and I can then input the new changed content into the registry.
Return The First Line Of A String
Anyone know if you can return the first line of a string only?
Gathering info from an Access DB and want the first line ONLY to be inserted into a listView
Feed The Window A Return
Does any know the code (in VBA) to feed a carrage return to a window. I.e. I have a macro that does something, but unfortunately one of the things it does is pop up a warning message... the answer to that pop up is always yes, so i want to add a line of code to the end of the macro that does this...
Return Line Number Of A Searched String In A Text File
I need to search a string in a text file, where can return a line number for later access, such as:
search for "Test_string"
Return line_number of where "test_string" is sitting in "text.txt".
anyone knows how to do that? Much appreciated.
quick dumb stupid question
What the Vb command for a Carriage return in a lable name LblDescription?
vbCR or something?
i'm trying to read a "memo" data type and write it to an asp.NET page. i would like to use a replace function to replace the carriage returns by "<br>".
however i don't know the C# constant for carriage return. i think it's vbCr in VB.NET, but i can't find the C# equivalent.
if anyone knows, thanks for letting me know
How can I stop a user from pressing the carriage return / enter button when typing in a textbox?
I tried checking for chr13 but not sure how to stop the user from hitting it accidetly.
Whats the vb keyword for a carriage return?
Ie Text1.Text = "Blah" + CR + "Blah"
What do I change CR to?
Thanks in advance
Im doing a simple text filtering program. user enters info and... fo rexample it will pick out the words begining with b's. im using a multiline textbox for input. how do i get the program to recognize a carriage return if the user decides to sperate the words by hitting enter?
right now i am taking the text box and reading it as 1 string. it recognizes blanks to seperate the words.
it is a college project so i understand how over simplified it is. however the info is useful
Private Sub cmdFindBs_Click() 'main program
'declare local variables
Dim Words As String, NextWord As String
Dim blank As Integer, Foo As Integer
Words = txtInput.Text 'get text from textbox
blank = InStr(1, Words, " ") 'find first blank
While blank <> 0 'continue until no more blank spaces
NextWord = Left$(Words, blank - 1) 'isolates word
If SeeIfB(NextWord) = True Then
'checks if word begins with b
lstDisplay.AddItem (NextWord) 'add word to lstbox
'trims string of first word
Words = Right$(Words, Len(Words) - blank)
'find next blank
blank = InStr(1, Words, " ")
'handles last word
NextWord = Words
If SeeIfB(NextWord) = True Then
Private Function SeeIfB(ThisWord As String)
Dim B As String 'declare local variables
B = Left$(ThisWord, 1) 'if word begins w/ b return true
If B = "b" Or B = "B" Then
SeeIfB = True
Else 'else return false
SeeIfB = False
How do I force a carriage return in a text box in between strings?
This is my code
If optMenu = 0 Then
txtChoice.Text = cboRegularStarter.Text
txtChoice.Text = cboRegularMain.Text
How can I force "txtChoice.Text = cboRegularMain.text" to be printed on a new line underneath "txtChoice.Text = cboRegularStarter.Text"
I would appreciate any help on this one. it is probably a very simple solution and I am just being stupid.
Carriage Return In VB
Can I perform a search on a string and do a replace with a carriage return character and create different lines within the file.. (to allow for records to be separated)
If I have a string that is 100 words(not characters)long, is there a way when that string (from a rich text box) is printed or emailed to determine where the carriage return will happen and that on the next line to add spaces before the rest of the string for an indention? Hope this makes sense.
Carriage Return In VB
I have created a script that parses throught a file with a fixed length row
of data. I am using the TextStream to write certain data to another file
that will be processed through another application. The trouble that I am
experiencing is that at the end of the file, it is writing an extra CrLf
which when it runs through the application, chokes. Any information or
hints on alternatives would be very much appreciated.
Thank you in advance....
S/W Applications Developer I
Mutual of Enumclaw Ins. Co
Carriage Return In Field Value
Hello. I have a form set up. I have read in values from a text file and assigned them to variables. The form is a Fax. In the "From" field, I want to put:
Only problem is, I only want the Title and Department to show up IF they are not blank. I'm trying to combine all three into one string or variant variable and then assign that variable as the "result" of the field. It looks like:
ActiveDocument.FormFields("Name1").Result = inName1 & vbCrLf & inDept1
If I use "vbTab", it works fine, but when I use "vbCrLf," I get a box instead of a carriage return... its the same type of box you get when you're looking at font substitution and the program places a box in the places of a character it doesn't know how to substitute. Any suggestions???... aside from separating these into separate fields?
Remove Carriage Return
I have imported data which has cells with squares in them representing carriage returns. I recorded a macro to replace "xxxx" with a space and then changed the:
What: = "xxxx" with
What: = chr(13)
This did not work. I can't use clean because that will just remove the carriage return whereas I need it to be replaced with a space.
How To Get Rid Of Those Carriage Return Boxes?
I take the text from a text box which has enters in them.
485 Rural Drive*
I get little squares where the stars are. Ive read that they are ascii characters or line return characters. Whatever they are i need to get rid of them. Any solutions or links to other posts? Thanks!!!
Carriage Return In Textbox
Does anyone know how to insert a carriage return in a textbox using the keyboard. I thought it was Ctrl+Enter or Shift+Enter... but no luck.
Carriage Return For Notepad
I am using VBA to write a program in excel, at the end of which is a program that writes an error report to a text file in notepad. There are already preprogrammed strings that are passed into this function and then simply output as strErrors for example. I was wondering how I can get a carriage return in this string that is passed into the error function. I have tried to use Chr(8), but it just shows up as a block in the text file. That is the only carriage return I know in VBA.
Opposite Of Carriage Return
I sending strings to a text box like this
and i do it by adding a carriage return after my string
Now the cursor is at the (*) and i want to go back up one line and delete the FGH: 789 .. i did learn how to delete using (len) but i dont know how to go back up one line.. please help!!
Carriage Return(enter Key)
hi you all
can anybody help!!
I'm trying to check for the enter key been pressed and for some reason it does not work. if I change the 13 to 32(space bar) it works fine what i'm i doing wrong.
All i want to do is change the updown1(control) to the value of the Text1.Tex(control).
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
response = MsgBox("dsdf", vbOKOnly, "dfg") 'just to see if it works
UpDown1.Value = Val(Text1.Text)
KeyAscii = 0
thanks the pig
Immediate Carriage Return In Listboxes
I'm not sure if it's possible, but is there a way to have a command enter a return after a statement is added to a listbox, so that the next line entered is on that line? I've been doing it with bunches of spaces and MultiLine set True, but that just seems to make a mess.
Parsing Looking For Carriage Return
I am loading in a string that contains several ascii representations of the Carriage Return. How would I parse through it and where the Carriage Return Ascii is replace it with a vbCrLf.
I am not good at parsing at all, in fact its my weakest areas...
So here is my example to the best of my ability without knowing the ascii code for the carriage return.
hello world||I am doing fine||hope you are too
Now I want to take that string and parse it so I can place it into a Textbox so it looks like this:
I am doing fine
I hope you are too