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




Too Many Line Continuations


Im getting this error in VB6 and i need to find something that can connect unlimited lines of text. Like This..
InputWord & " Yellow" & vbCrLf & _
InputWord & " Purple" & vbCrLf & _
InputWord & " Orange" & vbCrLf & _
InputWord & " Blue" & vbCrLf & _
InputWord & " Tan" & vbCrLf & _
InputWord & " Teal" & vbCrLf & _
InputWord & " Black" & vbCrLf & _
InputWord & " Brown" & vbCrLf & _
InputWord & " Grey" & vbCrLf & _
InputWord & " Chrome" & vbCrLf & _
InputWord & " Gold" & vbCrLf




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Too Many Line Continuations
While Creating string for SQL query i am getting error message from vb6 that "Too many line continuations"

strSql = "CREATE TABLE " & Tabledd & _
"(CNum int IDENTITY(1,1) PRIMARY KEY ," & _
"CC char (4)," & _
"PartnerId nvarchar (12)," & _
"CC2 nvarchar (20)," & _
"CC3 nvarchar (20)," & _
"CC4 nvarchar (50)," & _
"CC5 nvarchar (50)," & _
"CC6 nvarchar(50)," & _
"CC7 nvarchar (80)," & _
"CC8 nvarchar(80)," & _
"CC9 nvarchar (50)," & _
"CC11 nvarchar (50)," & _
"FF nvarchar (50)," & _
"Password nvarchar(50)," & _
"URL nvarchar(150)," & _
"VV numeric (9)," & _
" ProxyAddress nvarchar(100)," & _
"VV varchar(50)," & _
"EE varchar(50)," & _
"QQ varchar(50)," & _
"BB int ," & _
"QQ varchar(10)," & _
"NN numeric(9)," & _
"MM varchar(20)) "

if i try to add one more line it will give me error message. how can i avoid that error?

Too Many Line Continuations
Here is another problem. I get an error message if I want add another line continuation in the code below. Is there another way of line continuation?


VB Code:
richtxtOutput.Text = "<td width=""11%"" align=""center""><font color=""#FFFFFF""><b>" & txtField1.Text & "</b><br>" & _    Chr$(13) & Chr$(10) & "     <img src=""" & txtIcon1.Text & """> <br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX1.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX21.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtTemp1.Text & "</font></td>" & _    Chr$(13) & Chr$(10) & "     <td width=""11%"" align=""center""><font color=""#FFFFFF""><b>" & txtField2.Text & "</b><br>" & _    Chr$(13) & Chr$(10) & "     <img src=""" & txtIcon2.Text & """> <br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX2.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX22.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtTemp2.Text & "</font></td>" & _    Chr$(13) & Chr$(10) & "     <td width=""11%"" align=""center""><font color=""#FFFFFF""><b>" & txtField3.Text & "</b><br>" & _    Chr$(13) & Chr$(10) & "     <img src=""" & txtIcon3.Text & """> <br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX3.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX23.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtTemp3.Text & "</font></td>" & _    Chr$(13) & Chr$(10) & "     <td width=""11%"" align=""center""><font color=""#FFFFFF""><b>" & txtField4.Text & "</b><br>" & _    Chr$(13) & Chr$(10) & "     <img src=""" & txtIcon4.Text & """> <br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX4.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX24.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtTemp4.Text & "</font></td>" & _    Chr$(13) & Chr$(10) & "     <td width=""11%"" align=""center""><font color=""#FFFFFF""><b>" & txtField5.Text & "</b><br>" & _    Chr$(13) & Chr$(10) & "     <img src=""" & txtIcon5.Text & """> <br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX5.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX25.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtTemp5.Text & "</font></td>"  <---CAN"T ADD & _ HERE    Chr$ (13) & Chr$(10) & "     <td width=""11%"" align=""center""><font color=""#FFFFFF""><b>" & txtField6.Text & "</b><br>" & _    Chr$(13) & Chr$(10) & "     <img src=""" & txtIcon6.Text & """> <br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX6.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX26.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtTemp6.Text & "</font></td>" & _    Chr$(13) & Chr$(10) & "     <td width=""11%"" align=""center""><font color=""#FFFFFF""><b>" & txtField7.Text & "</b><br>" & _    Chr$(13) & Chr$(10) & "     <img src=""" & txtIcon7.Text & """> <br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX7.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX27.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtTemp7.Text & "</font></td>" & _    Chr$(13) & Chr$(10) & "     <td width=""11%"" align=""center""><font color=""#FFFFFF""><b>" & txtField8.Text & "</b><br>" & _    Chr$(13) & Chr$(10) & "     <img src=""" & txtIcon8.Text & """> <br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX8.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX28.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtTemp8.Text & "</font></td>" & _    Chr$(13) & Chr$(10) & "     <td width=""11%"" align=""center""><font color=""#FFFFFF""><b>" & txtField9.Text & "</b><br>" & _    Chr$(13) & Chr$(10) & "     <img src=""" & txtIcon9.Text & """> <br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX9.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtWX29.Text & "<br>" & _    Chr$(13) & Chr$(10) & "     " & txtTemp9.Text & "</font></td>"

Too Many Line Continuations????
How many vbNewLine's can you have at once? I get this error that says I have too many.

thanks

'Too Many Line Continuations' Help
Hi all, I would appreciate help on what is probably a simple problem to solve, I have tried google and not really been able to figure the problem and hence am asking here for assistance:

Here is the existing code:
" Block Trade: " & Format(Range("B1").Offset(Count + 1, 3), "##,##0") & _
" shares traded at " _
& Format(Range("B1").Offset(Count + 1, 1), "$##,##0.00") & "@<" & vbCr & _

Here is what I tried to do (essentially add more output):

" Block Trade: " & Format(Range("B1").Offset(Count + 1, 3), "##,##0") & _
" shares traded at " _
& Format(Range("B1").Offset(Count + 1, 1), "$##,##0.00") &_
", by " & Format(Range("B1").Offset(Count + 1, 12),"##,##0") & _
"/ " &Format(Range("B1").Offset(Count + 1, 13),"##,##0") & ". @<" & vbCr & _

It would not let me put in all the "_" continutaions and I do not know how to resolve the issue

Here is the entire existing code:

Range("B1").Offset(Count + 1, 4) = _
Range("B1").Offset(Count + 1, 15) & vbCr & _
Range("B1").Offset(Count + 1, 16) & vbCr & _
Range("B1").Offset(Count + 1, 17) & vbCr & _
Range("B1").Offset(Count + 1, 18) & vbCr & _
Range("B1").Offset(Count + 1, 19) & vbCr & _
Range("B1").Offset(Count + 1, 20) & vbCr & _
Range("B1").Offset(Count + 1, 21) & _
Range("B1").Offset(Count + 1, 11) & _
" Block Trade: " & Format(Range("B1").Offset(Count + 1, 3), "##,##0") & _
" shares traded at " _
& Format(Range("B1").Offset(Count + 1, 1), "$##,##0.00") & "@<" & vbCr & _
Range("B1").Offset(Count + 1, 22) & _
Range("B1").Offset(Count + 1, 11) & _
" " & _
Range("B1").Offset(Count + 1, 23) & _
" : " & _
"Block Trade:" & Format(Range("B1").Offset(Count + 1, 3), "##,##0") & _
" shares traded at " _
& Format(Range("B1").Offset(Count + 1, 1), "$##,##0.00") & _
", value traded of " _
& Format(Range("B1").Offset(Count + 1, 9), "$##,##0") & _
" , buying broker " & Format(Range("B1").Offset(Count + 1, 12), "##,##0") & _
", selling broker " & Format(Range("B1").Offset(Count + 1, 13), "##,##0") & "."

Thanks in advance for your valuable assistance

Best Regards

[VB6] Error: Too Many Line Continuations
Hi, I've got another problem (always me )

When I start up my project, I get the message:

Quote:




Too many line continuations






Followed up by:
Quote:





An error occurred while background loading module 'frmMonsters'. Background load will now abort and the code for some modules may not be loaded. Saving these modules to their current file name will result in code loss. Please load a new project.






Is there any way to fix it? It removes over 2000 lines from my coding, and that's the only reason. Thank god I backed up the project twice, so I don't need to have all of this fixed, but I would like to know how to prevent it in the future. Already did a search here, didn't find anything even related to this error. I'm not using any line continuations in the project.
Would appreciate the help

Line Continuations - Limit?
I believe you can't have 25 lines joined and cannot have 24 on the same line.

RESOLVED "Too Many Line Continuations" ??????
im getting this error when i try insert more line continuations "underscores" to break up a 25 line block of an insert sql statement. obviously id like to make it more legible than it is now because right now its a solid block on the screen. when i try put the values inserted onto their own seperate lines i get this error after doing only a few. obviously because my query is already 25 lines or so i already got loads of continuations already, but why is there a max? is there any way around it? or would i have to break it up into many queries?? thanks

Nevermind problem solved. i concatenated the sql query string every 15 or so continuations and that way i can break up the query into as many lines as i want. apparently its something to do with how much the compiler can be fed at one time.



Edited by - PiXiE22 on 11/17/2005 12:03:55 AM

Line Input #1, Line...how Do I Read Ahead One Line (or Back Up One Line)
I am loading a file line by line using the LIne Input but at one point i need to look ahead at the next line to decided what to do on the current line...how do i look ahead one line? or how do i use the line Input function and then back up? Any help would be greatly appreciated.

Shane Thomas
p.s. please email replys in addition to the reply of post too
shathoma@nmsu.edu

Line By Line Text File Read And Correct Each Line
Can anyone help me create a small program or have any pointers
on pieces of code that reads a text file from folder "unfixed" then
fix the contents and then store the corrected contents
in another folder "fixed" and then move the file in folder "unfixed" to folder "old"

Details of contents.
There is a space infront of each line that should be removed.
Between the first group of numbers and the second there should be a zero for every space.
Then after the second group of numbers there should be just one space and the rest trimed off.


011531015222360000500355 3350505212004 50122
011531015222360000500363 5336305212004 6255
011531015222360000503465 2404505212004 50022
011531015222360000503463 1345205212004 50025
02153101522236 13 1503256


The @ symbol represents where a space should be.
I would like to read the file and then correct it and then
place the fixed contents in another folder with the original name.
Below is how I would like it to look.

01153101522236000050035500000003350505212004@
01153101522236000050036300000005336305212004@
01153101522236000050346500000002404505212004@
01153101522236000050346300000001345205212004@
021531015222360000000013@

Replacing A Line Of Text With A Blank Line, Then Delete That Line
The code below works perfect, retrieving the string of text that the user selects from the listview. Then I do bla bla bla. What I want to do is convert this so that the the user selects a string from the listview which corresponse to a string in the file. then click remove. my problem is, how do i remove a line of text from a text file? if i open for reading i cant modify the contents, if i open for writing it erases the data. and i dont want to write the data into a string, parse out the string that i don't want then rewrite the file.... that could be....not so good...

---------------------------------------------------------------------------------
'the line that actually is in the file..
email=gmatteson@myemail.com
i want to remove this line...
---------------------------------------------------------------------------------
Dim strSelected As String
strSelected = lvwAccounts.ListItems(lvwAccounts.SelectedItem.Index)

Dim objFSO As New FileSystemObject
Dim objFile As File
Dim objTS As TextStream
Dim strReadline As String
Dim strFind As String
Dim strData As String
Dim strEmail As String
Dim blnFound As Boolean

Set objFile = objFSO.GetFile(App.Path & "pop3a.txt")
Set objTS = objFile.OpenAsTextStream(ForReading)
Do Until objTS.AtEndOfStream Or blnFound = True
'reads line in file
strReadline = objTS.ReadLine
strFind = "="
strData = (InStr(1, strReadline, strFind) + 1)
strEmail = Mid(strReadline, strData)
If strEmail = lvwAccounts.SelectedItem.Text Then
frmEdit.txtEmail = strEmail
blnFound = True
End If
Loop
---------------------------------------------------------------------------------
Thanks,
- Gabe

Needing Experienced Programmer For Help - Parsing && Changing Line By Line In Txt File
Hello,

I'm a senior in HS and needing some help parsing a text file.

I have this in the text file:

ProjectList(0) = ""
ProjectList(1) = "A015"
ProjectList(2) = "A049"
ProjectList(3) = "A052"
ProjectList(4) = "C033"
ProjectList(5) = "C035"
ProjectList(6) = "C036"
ProjectList(7) = "C039"
ProjectList(8) = "E001"
ProjectList(9) = "E017"
ProjectList(10) = "E018"
ProjectList(11) = "E025"
ProjectList(12) = "G076"
ProjectList(13) = "G079"
ProjectList(14) = "H007"
ProjectList(15) = "H012"
ProjectList(16) = "K253"
ProjectList(17) = "M002"
ProjectList(18) = "M036"
ProjectList(19) = "M042"
ProjectList(20) = "M043

Problem:

The problem is that if i add another entry, for example, ProjectList(16) = "K254" it has to be in sequential order/alphabetical order. Well, I need to be able to add a line, and then from there renumber the rest of the projectlist items, from that item down.. Because if you add one, say at ProjectList(2), it messes up the order.. No big deal you say...but the rest of the file goes to 138 records and everytime you have to renumber it by hand...I'd like to automate this..

I have tried using Split function in VB, filter, Replace function, but I can't seem to break apart each line, increment the number, and then do that the same for the rest of the file, all while being able to have this functionality work no matter where or what number in the sequence it is.... If anybody could guide me, I would be indebted... Thanks!!

I have attached a text file of it if anybody needs to see what I'm talking about...

Prevent Multi Line Textbox From Wrapping Incomplete Words To The Following Line
Hi.

I've created a textbox that will mimic a mainframe screen that has a dimension of 80 X 24.

The following textbox properties are set as follows:
Multiline = True
Word wrap = True

When a user enters text into this textbox the text will wrap after every 80 characters, just like it would when typing on a mainframe screen.

PROBLEM: I would like the textbox to wrap only complete words to the next line...just like this forum textbox that I am typing into right now does..
would anyone know the code to accomplish this?

Thanks in advance..
marc

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
automatically.

The MsgBox should say for example:


Footnote 1: carriage return, page 7
Footnote 2: carriage return, page 9
etc.


Could please somebody give me a hint ? Thank you very much in
advance.


Regards,


Andreas

Leading Spaces Of Each Line Ina Multi-line DataReport Field Has Been Trimmed
I have a multi-line textbox that update a SQL table field. However, when printing the field in a datareport, all leading spaces of each lines has been trimmed, just like all lines left-aligned. Is there any settings I need to set, or this is a bug of datareport? I got this problem in VB6 SP4 & SP5.
I've checked that the spaces have been saved in the SQL rec.
Moreover, I found that I put a multi-line textbox to a datareport label gets the same result.
Thx for your help.

Read, Find A Line And Delete The Line In Text File
Hi, I am writing codes to do the following things: read a line from a text file, if this is a matched line, delete the line and go to the next line.

Can any one give me some direction? Such as access mode, method to use, etc.

Thanks.

Getting Current Line And Position On Line For Regular And RichText Boxes.
Just like in Notepad for windows, I'd like to know how to get the line number and "column" if you will that is currently selected in a text box or rich text. The method should be fairly fast as some text files opened are > 300 kb. Thanks in advance

How To Display Second Line If The First Line In Text File Is Meet The Condition
Dear All,
Would you please tell me how to display second line if the first line in text file is meet the condition. I am using VB.NET.
I would appreciate your helps very much,
Tram88

.Input ( Read Contentsof Text File - Line By Line )
I'm trying to import Data from a text file, which includes the following,

Vessel Name
000115600
000025600
000000000
000089000
000019000
000000000
6670.43

The above file is updated every five minutes and I wish to retreive this data in
order to perform calc's and then display a completion time for a process on the
User Form.

code:-----------------------------------------------------------------------------
---
Open "YourFile.txt" For Input As #1
While Not EOF(1)
Input #1, YourVariable
List1.Additem YourVariable
Wend
Close #1
--------------------------------------------------------------------------------

Instead of adding to a list as in the above example, I want to process it Line by
Line ( How do I achieve this using .Input ).

Help

Reading A Tab Delimited Text File Line By Line Into An Array
I have a tab delimited file created by an outside source.
I am using the below code to read it's contents into an array.

Function openFile()
Dim FileNum As Integer
Dim TotalFile As String

FileNum = FreeFile
' Reads the entire file into memory all at once
Open "c:DBUpdaterpgstd.txt" For Binary As #FileNum
TotalFile = Space(LOF(FileNum))
Get #FileNum, , TotalFile
Close #FileNum
TotalFile = Replace(TotalFile, vbNewLine, vbTab)
Fields = Split(TotalFile, vbTab)

'For X = 1 To UBound(Fields) Step 1
' Now the array can be used in the mdb comparing
'Debug.Print Fields(X)
'Next

End Function

My issue is that I am trying to read the array in lots of 15 as the text file has 15 columns of data.

Some of the lines only have 4 columns of data, this is throwing out my retrieval process.

Here is a sample of the text file. (copy and paste into a text file read it correctly)

seq_idlevel_idproduct_iddescription_line1description_line2description_line3description_line4supplier_idupc_apndiscount_percentbuy_price_exbuy_price_incrrp_exrrp_incGST_percent
10P1Computer Systems
20P2Workstations
30V1HEWLETT-PACKARD
40ZCOB9939XW6200 DUAL 3.2GHZ, 1GB, 40GB SATANO INTEGRATED GRAPHICSPO_3371793900.004290.0010.0
50ZCOD2329T5710 800MHZ 256/256 XPE THIN CLNTMicrosoft Windows XP Embedded; MS IE 6.0Transmeta Crusoe 800 MHz ; PC540A13.12671.38738.52772.73850.0010.0
6

Line two only has 5 tabs then the next line starts, this obviously throws out my reading of fields.

However this file can be imported into Access and all columns are correct, so I know it can be done, just not with my limited VB knowledge.

please Help,

David

Line Input #n,,&lt;string&gt; Stops When [null] Is In The Line
VB6. Using line input #n,,<string. to read a file. It is a txt file and the records are variable length and may contain CTRL characters. When I read a record that has a [null] in it, it takes that as a CRLF and terminates the read. I therefore get a short record and the next record read is the continuation of the first one. My reading tells me that CRLF is the terminator of a record not [null]. A stumper for me. And yes, I am sure there is no CRLF AFTER the null. I read the record character at a time and it is a null all by its lonesome.
Thanks
matt.

Question is: How can I read this record FULLY at one time. I then have to go through and change the null to a space, so it has to be in the record, otherwise everything would shift.

Get Line Form Text File 1 Line At A Time
I am trying get some code that will get one line of txt from a file then after it done with that line grab the next line so on and so forth. I have been able to get it to run through a file but I canít get to do it one at a time. Here is some of the code I am trying to using now.

Sub TextStream ()

Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, _
TristateFalse = 0

Dim fs, f, ts, s

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(Form1.Dialog.FileName)
Set ts = f.OpenAsTextStream(ForReading, TristateUseDefault)

Call count1 ' Mycounter1

If Mycounter1 = Mycounter2 Then
ts.SkipLine
ts.Close

Else

Call count2 ' Mycounter2

s = ts.ReadLine
Form1.Text1.Text = s
ts.Close

End If

End Sub

Trouble Reading Line By Line From A Text File
This is what i have in a text file:

1ZOOMETRIC (12) S J MILLER (56)$ 6.70$ 6.20$ 4.70$ 4.90$ 2.40
2SHIRAZAMATAZZ (6) D J STAECK (56)$ 4.00$ 4.30$ 4.30$ 4.40$ 2.00
3CONSPIRATOR (3) G L SMITH (56)$21.80$20.60$22.20$22.70$ 6.20
4KING CANUTE (11) J S WHITING (56)$44.50$47.90$50.10$53.10$10.00
5WOOL ZONE (9) P KING (56)$22.50$20.50$22.40$21.40$ 5.70

This is the code I have:

Open "c:Test.txt" For Input As #2
Do While Not EOF(2)
Line Input #2, strLine
If Len(strLine) > 30 Then
a = Len(strLine) - 11
b = Mid(strLine, a, 5)
End If
Loop
Close #2

txtOutput.Text = b

I'm trying to get it to read a line and then put the result in a RichTextBox.
Then read the next line and put the result in the RichTextBox, and so on.

The code i have only returns the result from the last line ignoring the rest e.g. "21.40"

Thanks
lurch

Capture Api Line Images And Image.line Question
how do i capture picture of my graph plotted by the polyline function(attachment below) and can anyone tell me more about image1.line command and how do i draw circle on an imagebox.
Thanks

How Can I Read One Line By One Line From A Multiline Text Field ?
i have a few rows of data on the text box

is there anyway to do this ?

Richtextbox : How To Change/set A Line Position To Move The Line Up/down?
I want to write a line in a Richttextbox at a specific desired Position vertically, like in a picturebox.

For a picturebox to change the print position

Code:
Private Sub Command1_Click()
Picture1.CurrentY = 100
Picture1.Print "test" ' this prints the text beginning from y axis of
' 100 pixels down.
End Sub
How can I do the same for a RTBox?
(I dont mean a newlinefeed.)

If there is a solution for this, then I should place a text in a RTBox at
any position.

Ensuring Only 65 Chars Per Line In Multi Line Textbox
I have a text box that can have any number of lines, but each line can only have 65 characters (I'm using the SendMessage API). A blank space is treated the same as a character. Right now I'm adding a carriage return at every 66th character, which works fine if I don't go back and insert or change anything I already typed in. When I do try that the cursor gets put the end of all of the text in the text box. The only way to change any text is to back space to the point where I want to retype something.
I'm curious to know if anyone can give me some ideas about how I should go about doing this.
Thanks.

I'll post my code and you will see why I get pushed to the end of the text
Private Const EM_LINELENGTH = &HC1
charcount = SendMessage(txtDetails.hwnd, EM_LINELENGTH, txtDetails.SelStart, ByVal 0&)
txtDetails.Text = Left$(txtDetails.Text, InStrRev(txtDetails.Text, " ")) & vbCrLf & Mid$(txtDetails.Text, InStrRev(txtDetails.Text, " ") + 1)
txtDetails.SelStart = Len(txtDetails.Text)

Read File Line By Line, Populate Listbox
How can I read a text file line by line, and for each line, make a new row in the listbox?

Put Specified Line By Line Number Of A Text File Into String
All I need is to put a specified line of text from a text file (by line number) into a string. Thanks

Edit: Ill explain better

example:

Code:
open "cool.txt" for input as #1
getline 3, string '<--- puts line 3 into a string called "string"
close #1

Something to that effect. Thanks again.

Reading File Line By Line With Comma's In Lines
how is this does? I need to read line by line where each line has aprox about 30+ comma's.


currently tried using


Code:
Open App.Path & "monster.txt" For Input As #1
While Not EOF(1)
Input #1, line
dbObj.Execute (line)
Wend
Close #1

Read A Word In A Line Of Text And Delete That Line
I have some aim logs that I'm going to put in .txt format, and I want to be able to delete the text that the other person has written.

Is there a way for me to specify a screen name and have the program delete that line of text?

Thanks,
Brad

New Line (vbCrLf) Leaves Symbol? / New Line Alternatives?
Hi I have a form that reads and writes date to and from a text file. The data is inputted in text boxes on the forum. At the end of reach set of records I want it to create a new line in the text file. When using vbCrLf it works but when viewing the form I get a symbol after the data that is in that textbox:



Thankyou for any help

How To Read Rich Text Box Content Line By Line
Hi all. I got a rich text box and i wonder how i can read each line of it one by one. For example i want to read each line of it and display it in massage box.
Furthermore, if i have 10 line of content in textbox how i can refrence each line and display it in massage box?

I be happy if some one show me how this can be done.Thanks

Reading A Text File Line By Line For Spellcheck
i am building a word processor. i want to build a fairly basic spellchecker. i will create a txt file with a line by line list of words that can be used and want to check each word against this. i can get a array with all the words in the program and the txt file with the dictionary in it. anyone point me in the right direction on how do this. possibly in a loop but not sure. Thanks

Send Line By Line From A Richtextbox With Brake Between Each [Solved]
Here the program I have in mind

lets say my form has one richtext box. and the user types in the first line something then hits enter goes to the second line, ect....

How I for example make it so that, when the user hits a command button, it will messege the first line, then take a 1 second brake then send the second line take 1 second brake ect...

like
MsgBox "line 1"
delay (1)
MsgBox "line 2"
delay (1)
MsgBox "line 3"
delay (1)

ect... is it posible

thanks

Loading Lines From A Text File Line By Line
I need to be able to load a line from a text file, perform actions on the line then read out the next line and perform the same actions each time adding the text to a text box, so that by the end the text box will contain all the information from the text file but formatted as to how my code formats it.

My Knowledge of VB is quite limited so explanations of how to use any code posted will probably be needed.

Thanks in advance

Extract Line By Line Of String Freom RichTextBox ..
anyone know how to do this????

i hope to extract line by line from Rich Text Box..... just like how the "line input" works ....

i have search through the forum but no one ever done this

Run Time Error When Read File Line By Line
I'm trying to read a txt file line by line that I can stop reading at any place I want.
Below is the code:

VB Code:
Do While Not EOF(1)  Line Input #1, fString     Text1.Text = Text1.Text + fString + vbCrLfLoop

The problem is, if the txt file has empty lines at the end of it, it will have run time error : "Input past end of file".
Does anyone know how to solve this problem?
Thanks in advance!

Faster To Read Line By Line, Or Whole File And Then Process?
Which is faster: Opening a file line by line... or creating a dynamic arr() and get the whole file, split at new line, and put it into the array, then use the array?

* RESOLVED * Reading A File Line By Line Problem.
I'm reading a file and adding each line into a listview. I use InStr and Mid to take the first part of each line only, e.g. the text before the space. A typical line in the text file would be something similar to this:

breakers "Breakers Revenge"

In the above line, just the first part breakers is taken, which is exactly what I want. But some lines have a comma in like this:

galmidwo "Galaxian (Midway, old rev)"

In this line I want to take galmidwo which it does, but then it puts in the word "old" for the next line.

The problem I am having is that any line with a comma is treated as two lines (I think). So how can I stop this?



Code:
Dim strText As String

Open "listfull.txt" For Input As #1

Do While Not EOF(1)
Input #1, strText
pos = InStr(1, strText, " ")
strText = Mid(strText, 1, pos)
Set LItem = ListView.ListItems.Add(, , strText)
Loop
Close #1



Thanks.

Reading TextFiles Line By Line (Need To Know How To With Opening A File)
I have it setup to save the entries 1 entry per line. Now I don't know how to input the stuff in by each line. I need to do a loop as to where it will take the data from each line and put it in the appropriate textbox from each line. Please post how to do this. I have been having some problems with this.

Rich Textbox - Making A Given Line The Top Line Displayed
This is the short-and-sweet version of a question I posted earlier. Is there a way to make a given line in the rich textbox the first line displayed? (For example, if I want to display line #53 as the top line, is there a combination of methods/properties I can use to do this? I can't find any obvious technique.)

Searching For A String In A Text File Line By Line
eiSecure: The following code will work with single instances of the ~BEGIN and ~END tags, but it doesn't work with multiple instances (but you should be able to add it in if you play around with it for a bit).

VB Code:
Dim sFile As StringDim saFile() As StringDim strText As String Open "MyFile.txt" For Input As #1sFile = Input(LOF(1), 1)Close #1 saFile = Split(sFile, vbCrLf) For y = 0 To UBound(saFile)    If Trim$(saFile(y)) = "~BEGIN" Then        For x = y To UBound(saFile)            If Trim$(saFile(x)) = "~END" Then                For Z = y + 1 To x - 1                    strText = strText & saFile(Z) & vbCrLf                Next Z                strText = strText & vbCrLf            End If        Next x    End IfNext y Text1 = strText

Reading A Text File Line By Line ***RESOLVED***
Hi all,
I'm sure this is not as complicated as I'm making it but...
I'm trying to read a text file line by line
the text file consists of lines of data separated by commas... such as:
10,1.3,RP,15/12/00,,,,,,,
11,FF,,,SjR,15/12/00,09:26,0,,,

My code returns "10" then "1.3" then "RP" etc
I want it to return "10,1.3,RP,15/12/00,,,,,,," then "11,FF,,,SjR,15/12/00,09:26,0,,,"


VB Code:
'Open text fileOpen sFilePath For Input As #1'Loop through rowsDo While Not EOF(1)    Input #1, sCurrentLine    MsgBox sCurrentLineLoopClose #1


Can anyone help pls.

How Can I Read Only One Line Or Specific Line Of A Text File
How can i read only one line or specific line of a text file?

How To Force New Line Of Text In A Multi Line Textbox
For example, i want to print in vb like this

1. one
2. two

in c , i can do something like

printf("1. one
");
printf("2. two
");

If I need to display the same text in a VB textbox control, i must force a new line too. How could i do it in VB? Any help would be appreciated thanks in advance..

Check Every Line In Multi Line Textbox [resolved (already)]
hello again,

here i am with another problem, so i'll get straight to it.

i need to do the following code:

Code:If (Right(txtINPUT.Text, 1)) = ";" Then

for every line in a multi line textbox, as the code above just does the last character in the textbox. ive searched these forums and found nothing that is exactly what i want. ive found this but thats so much code, and im not sure if i could make that do what i want. there must be an easy way to do it, please let there be an easy way.

any help is very much appreciated.


Primary_Slave

----------------------------------------------------------------------------------------
I'm all wrapped up in my binary blanket and I'm coding on late into the night
----------------------------------------------------------------------------------------

Edited by - Primary_Slave on 10/12/2004 1:25:21 PM

File Copy Line By Line...Needs Delimiter Capability
I'm using the code below to read a file line by line, but I don't know how to get it to recognize a delimiter in the line so that I can stop reading at that point.

Private Sub Command1_Click()
Dim LinesFromFile As String, NextLine As String
Open App.Path & "TESTFILE.txt" For Input As #1 ' Open file.
Do Until EOF(1)
Line Input #1, NextLine
LinesFromFile = LinesFromFile & NextLine & vbNewLine
Debug.Print LinesFromFile
Loop
Close #1 ' Close file.
End Sub

Deleting A Line Based On What Ends The Line
I am a newbie looking to delete all lines from a file that end with 2 characters. It is very important that it only delete lines that end with these 2 characters and the lines can be any length in size. I have looked around quite a bit on her but I have been unable to find that particular instance. Any help would be appreciated.

Newbie Question: Read Line By Line?
how would you read line by line in a text file?
stupid question...tried lookin at the tutorials section;

thx!

Copyright © 2005-08 www.BigResource.com, All rights reserved