I'm currently making a program in Visual Basic 2010 for my Course work, and I'm struggling a little as it involves a "log-in system."
The system will save the Users Information in a folder (Called UserInfo.txt) (Address, Password, Email etc..), and the folder name being the username of the User.
When an Admin wants to view or edit a User, I want the Admin to be able to select the User from a drop-down list and when selected, the information of the user loads in and is displayed in the text boxes bellow (on the same form). The Information can then be edited and Saved back to the file of that user selected with a "Save" button.
You don't want to read a file from multiple folders, just to read a file and populate the appropriate textboxes. According to your specs there is only 1 file per directory and that is the userinfo.txt. Since you are not giving any specs for the file itself read here: ... and here ... for plain text file and here: ... for a csv file (I know the extension isn't csv, but still it's a text…
Try making a file with a list of all the usernames and there corresponding directory. Populate the drop down box with this list of usernames. When a name is selected then read the corresponding folder and open the file inside this folder. There are tutorials everywhere for reading and writing from text files in VB .Net such as ... Let me know how it all goes! Bernie.
I was thinking of setting the file with usernames and paths included. e.g. Username Path bernie d:\somedir\users\bernie\ david d:\somedir\users\david etc... Just a tab delimited text file Then read in the file and split the lines into a 2 element array. Do this in the load form section so it's ready to go when someone selects a user from your form. Then, loop through the array when someone selects a user until you get to that…
Although @ Adam, I do want to take a file from multiple folders, because The same file name will be in all the folders, and this file will store all of the information about the user. When a Admin is to edit the users Info, he will select the username from the listbox (or the folder name) of the user, and then this will populate the textboxes bellow. When the data is edited, the Information will be resaved in the correct folder.
Following is the txtFile Layout:
Username (Tobyjug2222) Password (hello) Account type (Admin) Reward Points (1000) Tutor Room (12HY) Date of Birth (02/01/94) First Name (Toby) Last Name (Daniel) House Number (4) Street (Yellow Brick Road) Village (Old Village) Town (Goonie) County (Cheshire) Post Code (CH1 6RB)
@Obsys, I was struggling to get your method to work because the reader wouldn't read it as a string, although it *was* decleared as a string.. when Debugging/ trying to find the error, I msgbox'ed the file path to see what it would display, and it gave me a "Argument 'Prompt' cannot be converted to type 'String'." & crashed.
Try making a file with a list of all the usernames and there corresponding directory. Populate the drop down box with this list of usernames. When a name is selected then read the corresponding folder and open the file inside this folder. There are tutorials everywhere for reading and writing from text files in VB .Net such as http://zorabyte.com/VBNETTutorials/ReadFileLineByLine.aspx
I was working on your Method over the last few days, and I created the file to store/ write all the users in, although I bumped into one problem, and that was how to give the User a path, that was connected to the username in that file.