Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

i'm a beginner vb.net programmer and would like some assistance with loading a txt file into some sort of a list.

 

What i have is:

a text file with some sort of delimiting method,

eg. firstname|lastname|age|etc...

or firstname:lastname:age:etc..

 

and i want to load this into some sort of a list with a column for each field, so:

 

______________________________

| first name | last name | age | etc...

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

nick thomas 34

john doe 23

 

etc

 

i currently have FileOpen and LineInput to read the file, but cannot get the fields into the columns in a ListView (i can parse it but don't know how to specify items.add to different columns).

 

Also how can i take the value of individual columns in a selected row and put them into TextBox 'es like First Name: Last name, etc?

 

sorry if this problem has been addressed before. any help would be greatly appreciated.

 

-michael

Posted

Write a routine that reads one line of text.

 

And then implement the following pseudocode.

 

Dim myLine as string
Dim myItems() as string 'array

open file

Do While Not file.eof
 myLine = ReadLine
 myItems = split(myLine)
 ... Process Items


Loop 

.nerd

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...