Hi need to make a progrma that requires a login system using text files, i dont want code to just know and allow acceess to one login but several logins. i also want the code to allow me to then enable an edit function when logged in as an administrator so that i can eidt add and delet userse from the system.

if anyone can help me out then that would be most kind of them and would save me lots of work.

thank you.

TnTinMN commented: I'm glad that you have specifically stated that you do not want someone to code this for you.. It show a lot of integrigty. +6

First create a text file that contains a couple names and passwords. You will ultimately need to eencrypt the passwords to prevent people from just using Notepad to read the text file. But you can skip that for now. Then create a loging form with user name and password text boxes. In the Ok button onclick event handler is where you put the code to read the text file and search for user's name then compare passwords.

Here is a thread about encrypting and decryption strings, but you probably won't need that until you get the login form working.

Don't worry about the rest of the problem until you get the above working.

I would suggest making the login form a dialog, that way you have a built in method for reading success, fail, or cancel

can you add strings to resource at runtime?

I am a ameture programmer working on a a level project. I really need some help. I would have used the built in database way to make the login but according to my teacher I can't use that method. I need to code it myself.

I understand the text file part on how to make it and load it to vb. But how do u I make the program know what username it should compare with what password. I need it to login or grant access to multiple users.

I was thinking that each user has a ID then according to that Id vb will read the text file go to that line and then just compare that lines password to the username. If they match then it will let the user in.

How I program vb to read a spasific line of the text file I don't know. Please help.
Thank you so so much.

You have two linked pieces of data: 1) username and 2) their password. To make this work, the username needs to be unique. This is why when signing up for any type of service that requires an username and password, that the service checks the availabilty of the selected username.

Since you have stated that your can not use the built-in databases, the next best thing to do would be to create some type list of (username, passord) pairs. The ideal .Net structure for this would be a Dictionary(Of string, string). Dictionary Generic Class

The key will be the username and the value will be the password.

Read through the documentation on its methods (hint: ContainsValue).

You have control over the textfile, so I would suggest that you use a simple delimitted file format. Comma delimitted is very common.

If you need to write a file you will be using System.IO.Stream and System.IO.StreamWriter.

To read a delimitted file, VB provides you a class to help with that.

How to: Read From Comma-Delimited Text Files in Visual Basic

@Zakkaria: You need to read your textbook or online tutorials about how to use vb.net read text files.

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.