hey everybody! :D
I am a major noob at programming and I am using VB '08 Express and want to use a text file to set variables on seperate forms of one program. What I would like to know is if i should use seperate files for each form and how to structure the text file and load it into seperate variables.

Example:
(text file)
User1 Info1, User1 Info2, User1 Info3, User1 Info4, etc.
User2 Info1, User2 Info2, User2 Info3, User2 Info4, etc.

(form code)
User1 Info1 = value1
User2 Info1 = value2
etc.


Is this even possible in VB? I have been reading posts for two days and it looks like its possible but not easy.

Any help is MUCH appreciated..
Blackknight

P.S. everything else is working good... just want this so i can edit the login without recoding.

Recommended Answers

All 2 Replies

I think it's possible to take values from file.TXT
btw, i'm using VB 2005, i don't know it is work for vb 2008 or not.

I take value per line from file.txt using an arraylist.

dim array as new arraylist

'open file.txt n allow file.txt to be read
dim file as new filestream ("[your file address], filemode.open, fileaccess.read")

'reading file.txt
dim sr as streamreader(file)

'inserting file.txt value to an array
while (sr.peek > -1)
      array.add (sr.readline)       'read value per line 
end while

'don't forget close the file.txt 
sr.close
file.close

'see file.txt value 1st line
msgbox(array(0))

for example:
file.txt calling value
line 1 : info1 array(0)
line 2 : info2 array(1)


i hope this help U...

hey thanks this i what i was looking for..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.