473,383 Members | 1,759 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,383 software developers and data experts.

need help reading contents of a file into an array...SKYPE ME.

Could anyone spare some time and try to help me out.

I've got a .txt data file with a name, pin, balance seperated by commas. I
am opening the file and using Split to split it between the ,'s I need to
read it into an array and then check if what was entered as a name by the
user is in the array.

Can anyone be of help? Please Skype me, using the Text chat of skype. I
can transfer code just using text.....I have the code written but I dont
think I am doing something right because whenever I enter a name it is
coming back as invalid. At this point I am not even sure if I have the
array built.

Skype name: vbnethelp

Or if someone could show me how to make an array reading from a file that is
seperated by commas as above and would contain 10 records.

thank you.
Feb 15 '06 #1
4 1489
Jason

Are you using VS 2005? If so, this is available as one of the code snippets
(under File System).

Dim filename As String = "C:\Test.txt"
Dim fields As String()
Dim delimiter As String = ","

Using parser As New TextFieldParser(filename)
parser.SetDelimiters(delimiter)

While Not parser.EndOfData
' Read in the fields for the current line
fields = parser.ReadFields()

' Add code here to use data in fields variable.
'e.g. fields(0) would be your Name field

End While
End Using

HTH

Richard
"Jason" wrote:
Could anyone spare some time and try to help me out.

I've got a .txt data file with a name, pin, balance seperated by commas. I
am opening the file and using Split to split it between the ,'s I need to
read it into an array and then check if what was entered as a name by the
user is in the array.

Can anyone be of help? Please Skype me, using the Text chat of skype. I
can transfer code just using text.....I have the code written but I dont
think I am doing something right because whenever I enter a name it is
coming back as invalid. At this point I am not even sure if I have the
array built.

Skype name: vbnethelp

Or if someone could show me how to make an array reading from a file that is
seperated by commas as above and would contain 10 records.

thank you.

Feb 16 '06 #2
VS.Net 2003 that is what I have here.

"Richard Bysouth" <sl***@nospam.nospam> wrote in message
news:4C**********************************@microsof t.com...
Jason

Are you using VS 2005? If so, this is available as one of the code
snippets
(under File System).

Dim filename As String = "C:\Test.txt"
Dim fields As String()
Dim delimiter As String = ","

Using parser As New TextFieldParser(filename)
parser.SetDelimiters(delimiter)

While Not parser.EndOfData
' Read in the fields for the current line
fields = parser.ReadFields()

' Add code here to use data in fields variable.
'e.g. fields(0) would be your Name field

End While
End Using

HTH

Richard
"Jason" wrote:
Could anyone spare some time and try to help me out.

I've got a .txt data file with a name, pin, balance seperated by commas.
I
am opening the file and using Split to split it between the ,'s I need
to
read it into an array and then check if what was entered as a name by the
user is in the array.

Can anyone be of help? Please Skype me, using the Text chat of skype.
I
can transfer code just using text.....I have the code written but I dont
think I am doing something right because whenever I enter a name it is
coming back as invalid. At this point I am not even sure if I have the
array built.

Skype name: vbnethelp

Or if someone could show me how to make an array reading from a file that
is
seperated by commas as above and would contain 10 records.

thank you.

Feb 16 '06 #3
Hi Jason,

Please post your code here, so someone can review it and let you know what
minor error exists.

Regards,

Cerebrus.

"Jason" <no**@none.invalid> wrote in message
news:uP**************@TK2MSFTNGP12.phx.gbl...
VS.Net 2003 that is what I have here.

"Richard Bysouth" <sl***@nospam.nospam> wrote in message
news:4C**********************************@microsof t.com...
Jason

Are you using VS 2005? If so, this is available as one of the code
snippets
(under File System).

Dim filename As String = "C:\Test.txt"
Dim fields As String()
Dim delimiter As String = ","

Using parser As New TextFieldParser(filename)
parser.SetDelimiters(delimiter)

While Not parser.EndOfData
' Read in the fields for the current line
fields = parser.ReadFields()

' Add code here to use data in fields variable.
'e.g. fields(0) would be your Name field

End While
End Using

HTH

Richard
"Jason" wrote:
Could anyone spare some time and try to help me out.

I've got a .txt data file with a name, pin, balance seperated by commas. I
am opening the file and using Split to split it between the ,'s I need
to
read it into an array and then check if what was entered as a name by the user is in the array.

Can anyone be of help? Please Skype me, using the Text chat of skype.
I
can transfer code just using text.....I have the code written but I dont think I am doing something right because whenever I enter a name it is
coming back as invalid. At this point I am not even sure if I have the
array built.

Skype name: vbnethelp

Or if someone could show me how to make an array reading from a file that is
seperated by commas as above and would contain 10 records.

thank you.


Feb 16 '06 #4
Jason,

You can use for this OleDB and read than with some instructions the complete
file in a dataset.

Have a look at this sample on our website.

http://www.vb-tips.com/default.aspx?...f-212f9e0de193

I hope this helps,

Cor
"Jason" <no**@none.invalid> schreef in bericht
news:%2****************@tk2msftngp13.phx.gbl...
Could anyone spare some time and try to help me out.

I've got a .txt data file with a name, pin, balance seperated by commas.
I am opening the file and using Split to split it between the ,'s I need
to read it into an array and then check if what was entered as a name by
the user is in the array.

Can anyone be of help? Please Skype me, using the Text chat of skype. I
can transfer code just using text.....I have the code written but I dont
think I am doing something right because whenever I enter a name it is
coming back as invalid. At this point I am not even sure if I have the
array built.

Skype name: vbnethelp

Or if someone could show me how to make an array reading from a file that
is seperated by commas as above and would contain 10 records.

thank you.

Feb 16 '06 #5

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

Similar topics

0
by: Row | last post by:
HI, I would first like to say its been about 3 years since looking at java im very rusty! I have to write a post it notes type applet which will function online. (reading from a flat text file)...
3
by: Markus Hofmann | last post by:
Hi @ all hope someone can help me as my PC is ready to go through the window...here it is: I have a text file with approximately 150,000 lines of the following format: ...
6
by: Foxy Kav | last post by:
Hi, another question from me again, i was just wondering if anyone could give me a quick example of reading data from a file then placing the data into an array for some manipulation then reading...
2
by: Sabin Finateanu | last post by:
Hi I'm having problem reading a file from my program and I think it's from a procedure I'm using but I don't see where I'm going wrong. Here is the code: public bool AllowUsage() { ...
12
by: mitek777 | last post by:
Hi, I have a problem with reading from file. I would like to find some string(f e.g. name) in file, and if it exist show it on screen with second and third line under. I have this in file: ...
12
by: steven acer | last post by:
hello, i have a java app that constructs an xml from a specific file format and vice versa. i've been asked to convert it to c++, but im not an expert in c++, actually im mere beginner you can...
4
by: Paul David Buchan | last post by:
Hello, I'm attempting to write a program to read in database files (.dbf). When I do it all as a single procedure in main, everything works. However, what I really want, is to pass the database...
0
by: Dudely | last post by:
I've got a weird problem. I'm trying to pull the phone number off a webpage (you can see it below if you search for "context"), but somehow SKYPE has usurped the HTML DOM in a way I don't...
11
by: blunt | last post by:
trying to write a program to write the configuration files for a load of wireless access points. i've never been a good programmer and haven't done any for nearly a decade so have obviously made some...
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
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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?

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.