By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,165 Members | 1,429 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,165 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.