Can anyone help me to convert this into vb.net, mine can't convert. Thank!
Or can someone know how to save the array to a file (text, ...what ever) and when the app start, read the file back into an array, and validate user inputs (example: login password)
Thank again in advance.
Option Explicit
'Used for demonstration purposes only
Const sPassword As String = "pass1,pass2,pass3,pass4,pass5"
'You password array
Private sPassArray() As String
Private Sub Form_Load()
'Populate the password array for demonstartion
'purposes only
sPassArray = Split(sPassword, "," )
End Sub
'Save the password list
Private Sub Command1_Click()
Dim lfn As Long
Dim sBuffer As String
'Join the array into a string buffer
sBuffer = Join(sPassArray, "," )
'Get a free file number
lfn = FreeFile()
'Open the file
Open "c:\password.txt" For Binary Access Read Write Lock Read Write As lfn
'Write the string buffer to the file
Put lfn, , sBuffer
'Close the file
Close lfn
End Sub
'Get the password list
Private Sub Command2_Click()
Dim lfn As Long
Dim sBuffer As String
'Get a free file number
lfn = FreeFile()
'Open the file
Open "c:\password.txt" For Binary Access Read Write Lock Read Write As lfn
'Initialise the string buffer
sBuffer = String$(LOF(lfn), 0)
'Get the string buffer from the file
Get lfn, , sBuffer
'Close the file
Close lfn
'Split the sting buffer into the array
sPassArray = Split(sBuffer, "," )
End Sub[edit]added VB tags to make the code easier to read[/edit]