Search a .txt file for valid password.

Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2005
Posts: 49
Reputation: ohyeah is an unknown quantity at this point 
Solved Threads: 1
ohyeah ohyeah is offline Offline
Unverified User

Search a .txt file for valid password.

 
0
  #1
Apr 2nd, 2008
I've got a .txt file with lots of passwords in, in the following format:

(passwords must be between 12-15 characters)

password1
password2
password3


i want to use a text box that allows the user to enter a password & upon the correct password being entered they are allowed to proceed to the next form.


something like this, i would guess:

Dim sr as StreamReader = File.OpenText("C:\test.txt")   
Dim password as string


if  PasswordTextBox = 'a value inside the text file'

then 'proceed to next screen'

else 'password incorrect'




Thanks
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 514
Reputation: techniner is an unknown quantity at this point 
Solved Threads: 19
techniner techniner is offline Offline
Posting Pro

Re: Search a .txt file for valid password.

 
0
  #2
Apr 2nd, 2008
  1. Private FileName AsString
  2. Dim sr As StreamReader
  3.  
  4. Function MyParseFunc(ByVal strFileName AsString)
  5.  
  6. Try
  7.  
  8. FileName = strFileName
  9.  
  10. sr = New StreamReader(FileName) 'using streamreader to read the opened text file
  11.  
  12. Dim strHTml AsString = sr.ReadToEnd
  13.  
  14. Dim userinput AsString = variable_passed
  15.  
  16.  
  17. Dim strStop AsString = "#end#" 'put this at the end of the file so it marks it as the end of file.
  18. Do
  19.  
  20. Select case strHtml
  21. Case strHtml = LTime
  22. 'Do something here
  23. Case strHtml = CTime
  24. 'Do something here
  25. LoopWhile strHTml <> strStop
  26.  
  27. Catch es As Exception
  28.  
  29. MessageBox.Show(es.Message)
  30.  
  31. Finally
  32.  
  33. If Not (sr IsNothing) Then
  34.  
  35. sr.Close()
  36.  
  37. EndIf
  38.  
  39. EndTry
  40.  
  41. End Function
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 49
Reputation: ohyeah is an unknown quantity at this point 
Solved Threads: 1
ohyeah ohyeah is offline Offline
Unverified User

Re: Search a .txt file for valid password.

 
0
  #3
Apr 2nd, 2008
thanks but this shows up so many errors. is there anything i need to import?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1411 | Replies: 2
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC