473,382 Members | 1,809 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.

retrieving data from text file thru visual basic

hi

in the text file iam having the data as mention below.i want 2 retrieve thru vb.

2 34 56 98 245

i want 2 retrive the data individually which is separate by space.

now i can able 2 retrive the first

left(str, (Instr(str,"")) ------ 2

and the last by

Instrrev(str, "") ----------- 245

i cant able 2 retrieve the middle numbers such as 34, 56 , 98.

can anyone give me idea to solve this problem

regards

vivek
Nov 1 '06 #1
1 1330
inter7
1
You can try with this code:

-----------------------------------------------------------------------------
V = "2 34 56 98 245"
P = 1
SpPos = 1

While SpPos > 0

SpPos = InStr(P, V, Space(1))

If SpPos > 0 Then
RetVal = Mid(V, P, SpPos - P)
Else
RetVal = Mid(V, InStrRev(V, Space(1)) + 1, Len(V) - InStrRev(V, Space(1)) + 1)
End If

P = SpPos + 1

Print RetVal
Wend
-----------------------------------------------------------------------------

This is not the best way to do it ... anyway ... it works.

Bye

Inter7
Nov 1 '06 #2

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

Similar topics

6
by: sea | last post by:
I have text files in the following format: 123,34, ,345,890, 123,23 .. .. .. As you can see, the problem is that (1) the commas can occur in
1
by: Jeffrey B. Holtz | last post by:
I'm trying to get the Name of the USB device pluged in from the RegisterDeviceNotification that I've used P/Invoke to marshal. I have seen a similar posting on the VisualBasic newgroups but I do...
3
by: Bre-x | last post by:
Hi, I have a text file that is made of a number of paragraphs: each paragraph start with either: ":O", ":N", or ":" follow by a 4 digit number and finish with either: M30 or M99 What I need...
1
by: SamG | last post by:
Hello, Does anyone know how I can Write a Cookie and then later retrieve it...? Also, Is it possible to write attributes and corresponding values to the cookie file.Needless to say would require...
3
by: Dennis | last post by:
How can I save then retrieve an image from an access Database using VB.Net? -- Dennis in Houston
6
by: portCo | last post by:
Hello there, I am creating a vb application which is some like like a questionare. Application read a text file which contains many questions and display one question and the input is needed...
0
bmallett
by: bmallett | last post by:
First off, i would like to thank everyone for any and all help with this. That being said, I am having a problem retrieving/posting my dynamic form data. I have a form that has multiple options...
9
ADezii
by: ADezii | last post by:
One question which pops up frequently here at TheScripts is: 'How do I retrieve data from a Recordset once I've created it?' One very efficient, and not that often used approach, is the GetRows()...
9
by: a | last post by:
Dear friends I want import data from CSV file to mdb file How can I do that in vb.net?
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: 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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.