How to search for a certain line of text from a text box in a textfile?

48 views Asked by At

I am creating a voting system using vb.net. The way how it works is as follows:

  • An administrator logs into the program and creates a list of voters of whom are eligible to vote.
  • The admin creates the voters' usernames and passwords and saves it in a text file.
  • After this is created, the voters are able to log into the system and start voting.
  • After voting, the user's vote is stored in text file.

For this program, I want to stop the voter from voting again if they have previously voted. So if a voter ( who has already voted) enters their username and password and then clicks the verify button, a messagebox should appear which says that "You have already voted". Does anyone have any idea of how I can do this?

1

There are 1 answers

0
Lajos Arpad On

Add additional information to your text file, like "voted" for the users who have already voted. When the user tries to vote and logs in you can get the information whether he has already voted by reading the user information from the text file. However, I would use a database manager system for this, like MySQL.