Re: Reading in a textfile?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



rowe_newsgroups wrote:
Look up filestream.

Or if you're using VB2005, look up System.IO.File.ReadAllLines, which will
read each line of a text file into separate elements of a string array, all
in just one line of code. Lovely. :)

Also, I would highly suggest using a Xml file instead of just a text
file.

Something like:

<Accounts>
<Users>
<Bill pin="1111" />
<Tom pin="2222" />
<Chris pin="3333" />
</User>
</Accounts>

....although if you do use XML, I'd structure it more like this:

<Accounts>
<Users>
<User name="Bill" pin="1111" />
<User name="Tom" pin="2222" />
<User name="Chris" pin="3333" />
</Users>
</Accounts>

....or like this:

<Accounts>
<Users>
<User>
<Name>Bill</Name>
<Pin>1111</Pin>
</User>
<User>
<Name>Tom</Name>
<Pin>2222</Pin>
</User>
<User>
<Name>Chris</Name>
<Pin>3333</Pin>
</User>
</Users>
</Accounts>

....XML has some strict rules about the naming of elements, and you don't
want to get to the end of your project and find that you can't store names
with spaces in, or with apostrophes such as in "O'Brien".

You might also want to consider encryption of the PINs...

--

(O)enone


.