473,382 Members | 1,424 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Process text file, line by line

4
trying to get this code to loop through a text document line by line.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.  
  3. WordFoundFlag = 0
  4. For i = 1 To Len(Text1)
  5.     Char = Mid(Text1, i, 1)
  6.     If Char Like "[A-Za-z-]" And WordFoundFlag = 0 Then
  7.         WordFoundFlag = 1
  8.         StartPos = i
  9.     ElseIf Char Like "[!A-Za-z-]" And WordFoundFlag = 1 Then
  10.     ElseIf Char Like "[!0-9]" And WordFoundFlag = 1 Then
  11.         GoTo BYE
  12.     End If
  13. Next
  14.  
  15. BYE:
  16.  
  17. FindFirstWord = Mid(Text1, StartPos, i - StartPos)
  18. Text1 = Replace(Text1, FindFirstWord, "")
  19.  
  20. End Sub
Any HELP would be great
Jun 24 '07 #1
6 1414
Killer42
8,435 Expert 8TB
It would help if you could give us some idea of what the problem is.
Jun 24 '07 #2
LesC
4
I am trying to remove the line numbers of a text document.

Example:
N10 G01 F720 X0Y0Z0
N20 X0Y0Z0
etc...
N9000 X0Y0Z0
M0
Jun 24 '07 #3
Killer42
8,435 Expert 8TB
You've told us what you want to do, but not specifically what the problem is. Also, what version of VB are you using?
Jun 24 '07 #4
LesC
4
i am using vb6 and as i said in my first post, i am trying to use tne code that i posted but can only get it to work on the first line and i need it to do the entire document.

thank you
les
Jun 25 '07 #5
Killer42
8,435 Expert 8TB
Well, if you have a look in the index at the top of the VB forum there are a couple of samples showing how to read a text file. One of them reads line by line. So you could take that and adapt it to call your routine for each line.
Jun 25 '07 #6
LesC
4
Thank You, will give it a try
Jun 26 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sean | last post by:
I can connect to a machine remotely with no problems but I'm having trouble trying to create a process remotely. Initially this was a perl and VB script which I'm converting to python. Its entire...
0
by: Justin Johnson | last post by:
Hello, I was wondering if anyone has seen this behavior before for the process.py module available at http://starship.python.net/crew/tmick/. I've been using it quite well on windows 2000...
1
by: Peter Åstrand | last post by:
There's a new PEP available: PEP 324: popen5 - New POSIX process module A copy is included below. Comments are appreciated. ---- PEP: 324 Title: popen5 - New POSIX process module
5
by: Joseph | last post by:
Hello, I have a C# program that builds a txt file and then, calls an external exe (this external exe simply imports this txt file into a DBF (DBase) file. (we copy a template of the DBF file into...
0
by: emailallrise | last post by:
Hi ya all, I'v made a simple app that reads the *.vbproj file and generates a command line that I can execute on the console to compile my app. Now I modified my app so that by using the process...
15
by: jcrouse | last post by:
Here is my code: Dim sw As StreamWriter = File.CreateText(Application.StartupPath & "\mameversion.bat") sw.WriteLine(lblMameExePath.Text & " -help >""" & Application.StartupPath &...
0
by: wayne hamilton | last post by:
I'm having a problem Interacting with Command Line programs. I can read and write anything I want as long as I don't have to interact with a process once it's started. Originally I had been calling...
13
by: George | last post by:
Hi, I am re-writing part of my application using C#. This application starts another process which execute a "legacy" program. This legacy program writes to a log file and before it ends, it...
0
by: mix01 | last post by:
Hi, I am trying to get some VBA code working, but am preplex as to why it does not work. I would really appreciate any level of help. Many thanks, Mix01 Version of the program
0
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I started a thread regarding this issue, but now i'm facing new problem, so i'm starting a new thread, hope it's ok... anyway, using my c# windows application, i'm excuting and exe file...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.