473,770 Members | 6,348 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do get VB to start text extraction in a certain are?

hi, i've been trying to figure out how to make visual basic start
extracting text at a certain line to when i tell it to stop. I am making
trying to make a program where it extracts text from a text file and
inserts it into a database. But right now i'm stuck at finding a way to
code it so the text extraction doesn't start till after the second set
of dashes, here is part of text file. I want to extract ACL ET AL
SNIPELK 8-27-70-18 and so on.... Can someone guide me down the right
path?

DATE: 04 November 2003
------------------------------------------------------------------------
--------------------
WELL NAME LICENCE NUMBER MINERAL RIGHTS GROUND ELEVATION
UNIQUE IDENTIFIER SURFACE CO-ORDINATES BOARD AREA OFFICE PROJECTED
DEPTH
LAHEE CLASSIFICATION FIELD TERMINATING ZONE
DRILLING OPERATION WELL PURPOSE WELL TYPE SUBSTANCE
LICENSEE SURFACE LOCATION

------------------------------------------------------------------------
--------------------

ACL ET AL SNIPELK 8-27-70-18 0024070 ALBERTA CROWN 791.6M
100/08-27-070-18W5/02 S 647.7M W 595.1M GRANDE PRAIRIE 3164.0M
DEV (NC) SNIPE LAKE SWAN HILLS MBR
HORIZONTAL RESUMPTIONPRODU CTION CRUDE OIL
APACHE CANADA LTD. 10-27-070-18W5

much appriciated thanks
Jul 17 '05 #1
3 3432
"Kangol kangoll" <ka****@whoever .com> wrote in message
hi, i've been trying to figure out how to make visual basic start
extracting text at a certain line to when i tell it to stop. I am making
trying to make a program where it extracts text from a text file and
inserts it into a database. But right now i'm stuck at finding a way to
code it so the text extraction doesn't start till after the second set
of dashes, here is part of text file. I want to extract ACL ET AL
SNIPELK 8-27-70-18 and so on.... Can someone guide me down the right
path?

If what you want is near the start of the file, read the file line by line
and when you get a line full of dashes, increment a counter. When
that counter is at 2, you know you need to start keeping the data you
are reading in. I presume, when the counter gets to 3, you're done.

See Line Input in VB Help for an example....

LFS

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 17 '05 #2
You can't tell any non-random access file method to 'begin reading at line
x' ... you have to start from the beginning and loop through the contents.
(And FYI, your file format does not follow a random access file structure so
that method is also not applicable to your data).

--

Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.
"Kangol kangoll" <ka****@whoever .com> wrote in message
news:Xn******** *************** *******@198.161 .157.145...
: hi, i've been trying to figure out how to make visual basic start
: extracting text at a certain line to when i tell it to stop. I am making
: trying to make a program where it extracts text from a text file and
: inserts it into a database. But right now i'm stuck at finding a way to
: code it so the text extraction doesn't start till after the second set
: of dashes, here is part of text file. I want to extract ACL ET AL
: SNIPELK 8-27-70-18 and so on.... Can someone guide me down the right
: path?
:
: DATE: 04 November 2003
:
:
: ------------------------------------------------------------------------
: --------------------
: WELL NAME LICENCE NUMBER MINERAL RIGHTS GROUND ELEVATION
: UNIQUE IDENTIFIER SURFACE CO-ORDINATES BOARD AREA OFFICE PROJECTED
: DEPTH
: LAHEE CLASSIFICATION FIELD TERMINATING ZONE
: DRILLING OPERATION WELL PURPOSE WELL TYPE SUBSTANCE
: LICENSEE SURFACE LOCATION
:
: ------------------------------------------------------------------------
: --------------------
:
: ACL ET AL SNIPELK 8-27-70-18 0024070 ALBERTA CROWN 791.6M
: 100/08-27-070-18W5/02 S 647.7M W 595.1M GRANDE PRAIRIE 3164.0M
: DEV (NC) SNIPE LAKE SWAN HILLS MBR
: HORIZONTAL RESUMPTIONPRODU CTION CRUDE OIL
: APACHE CANADA LTD. 10-27-070-18W5
:
:
:
: much appriciated thanks
Jul 17 '05 #3
That key looks familiar to me, maybe it's because I used to work with
something similar back at my Edmonton Alberta Department of Energy contract
;-). Oil Sands right? ;-)

If the header of the file is always the same (which I suspect it probably
is) just open a typical text file with an editor...count the lines until
the line you want to start extract from and loop that number of times....for
instance if your file has a line of dashes, 3 lines of information, and
another line of dashes and then the information you need starts. In this
example I assume it's 56 lines of header including the dash lines: Also what
would trigger you stopping to read the file? the end of file marker? a
specific character or combination of characters at the end of the
extraction? or do you need to paus at each line and make a decision as to
what to do next?

Dim FileNumber as Integer
Dim Counter as Integer
Dim WorkString as String

FileNumber = FreeFile()
Open "Filename.t xt" for input as #FileNumber
For Counter = 1 to 5
Line Input #FileNumber, WorkString
Next Counter

' ----------------------------------------
' Here you start reading the information
' I'm assuming the end of file will exit
' ----------------------------------------
Do While Not EOF(FileNumber)
Line Input #FileNumber, WorkString
' Here you parse and extract your information from WorkString
' and save it to the database
Loop
CLose #FileNumber

And there you have it :-).
--
Stéphane Richard
Software Developer
"Kangol kangoll" <ka****@whoever .com> wrote in message
news:Xn******** *************** *******@198.161 .157.145...
hi, i've been trying to figure out how to make visual basic start
extracting text at a certain line to when i tell it to stop. I am making
trying to make a program where it extracts text from a text file and
inserts it into a database. But right now i'm stuck at finding a way to
code it so the text extraction doesn't start till after the second set
of dashes, here is part of text file. I want to extract ACL ET AL
SNIPELK 8-27-70-18 and so on.... Can someone guide me down the right
path?

DATE: 04 November 2003
------------------------------------------------------------------------
--------------------
WELL NAME LICENCE NUMBER MINERAL RIGHTS GROUND ELEVATION
UNIQUE IDENTIFIER SURFACE CO-ORDINATES BOARD AREA OFFICE PROJECTED
DEPTH
LAHEE CLASSIFICATION FIELD TERMINATING ZONE
DRILLING OPERATION WELL PURPOSE WELL TYPE SUBSTANCE
LICENSEE SURFACE LOCATION

------------------------------------------------------------------------
--------------------

ACL ET AL SNIPELK 8-27-70-18 0024070 ALBERTA CROWN 791.6M
100/08-27-070-18W5/02 S 647.7M W 595.1M GRANDE PRAIRIE 3164.0M
DEV (NC) SNIPE LAKE SWAN HILLS MBR
HORIZONTAL RESUMPTIONPRODU CTION CRUDE OIL
APACHE CANADA LTD. 10-27-070-18W5

much appriciated thanks

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2974
by: Jason Huang | last post by:
Hi, Would someone show me how to do the data extraction to Excel in ASP.Net using C# web form? I am not familiar with VB, so I am asking someone to help me out! Any help will be appreciated. Jason
3
11750
by: Dean Slindee | last post by:
The code below is being used to launch WinWord.exe from a VB.NET program. Word launches, but displays this error message: "Word has experienced an error trying to open the file. Try these suggestions. 1) Check the file permissions for the document or drive. 2) Make sure there is sufficient free memory and disk space. 3) Open the file with the Text Recovery converter." The document that I want to display is on my PC and was created by...
1
2336
by: James Lehman | last post by:
Hello. I want to write a program that reads AutoCAD shape (font) files. They are written with the convention that hexadecimal values have a leading zero and decimal values do not. All numbers can be negative or positive. All numbers can be stored in a single byte. My questions is: can ifstream extraction into an int see the leading zero and interpret the number as hex and can I ask the ifstream, right after the extraction, if the value I...
2
1366
by: Miro | last post by:
In VB-2003, I was wondering if someone can point me in the right direction: Lets say the user has a shortcut on his desktop to your app. 1. Is there any way to capture what the "Start In" parameter is when the app loads? 1.1 Is there any way to be able to see this in the Process when you grab it?
1
1988
by: alw0015 | last post by:
I'm working on a piece of code that reads in a time from the user. This time value consists of 3 separate inputs: 1 integer representing hours 1 char representing the ":" 1 integer representing minutes for example:
2
2509
by: Vyz | last post by:
I am looking for a PDF to text script. I am working with multibyte language PDFs on Windows Xp. I need to batch convert them to text and feed into an encoding converter program Thanks for any help in this regard
3
2333
by: dec01louis | last post by:
Hi all, actually i'm now doing something on license plate recognition system for my project. The first step would be the license plate extraction algorithm which means it is needed to extract a license plate from an image captured. So, i wonder how can this be done? Actually i'm thinking of something like detect the image pixels of the license plate since the license plate that i'm gonna work on at this stage is black and white in color. So that...
3
4676
by: Zoroxeus | last post by:
Hi I have a problem copying the result of a filter on excel to another sheet This is thefunction i use to filter oSheet: oSheet.Range("A1", "AP" & LastRowAll).AutoFilter(2, ">01/03/2007") So it does the job, now what I want to do is to copy this information on "sheet2", ie i don't want to see the hidden row. I managed to copy everything but the hidden row show up. Pretty much what i want to do is to extract any information...
16
4350
by: EM.Bateman | last post by:
Working on Visual Studio .Net I've implemented a class: #ifndef CONTRIBUTOR_H #define CONTRIBUTOR_H enum Gender {male=1, female, unk}; #include <iostream> #include <iomanip> #include <string>
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10225
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10053
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8880
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.