Re: Reading in a textfile?



On Mar 1, 12:48 pm, "Ron" <pts4...@xxxxxxxxx> wrote:
Hello everyone,

I've created a functioning ATM program, a bank machine.

Now I want to implement usernames and Pins into it. So I have a text
file with this info.
BILL, 1111
TOM, 2222
CHRIS, 3333

How do I go about reading those values from a text file into arrays
and then access those arrays?

Look up filestream.

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>

Then use something like this to validate users

'Imports System.Xml assumed

private function IsValid(userName as string, userPin as string)
Dim doc as XmlDocument
doc.Load("MyXmlFilePath.Xml")
Dim node as XmlNode = doc.GetElementsByTagName(userName)(0)
if node.Attributes("pin").Value = userPin then
return True
else
return false
end if
end function

Thanks,

Seth Rowe

.



Relevant Pages

  • Re: Save User Information
    ... Function SetCustomProperty(strPropName As String, intPropType _ ... Dim doc As Document, prp As Property ... Set cnt = dbs.Containers!Databases ' Define Container object. ... Set doc = cnt.Documents!UserDefined ' Define Document object. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Save User Information
    ... >Function SetCustomProperty(strPropName As String, intPropType _ ... > Set cnt = dbs.Containers!Databases ' Define Container object. ... >' to Properties collection of Document object. ... > Dim doc As Document, ...
    (microsoft.public.access.modulesdaovba)
  • Re: AutoNew or AttachAs "name??" to create file name from data
    ... Dim Doc As Document ... Dim DocPathName As String ... can be deleted when the kill statement is executed. ...
    (microsoft.public.word.vba.general)
  • Re: Object variable or With block variable not set
    ... elemName As String) As ... DOMDocument40 ... Dim doc As New MSXML2.DOMDocument ... Dim n As IXMLDOMNode ...
    (microsoft.public.vb.general.discussion)