Jump to content
Xtreme .Net Talk

s01655468

Members
  • Posts

    4
  • Joined

  • Last visited

s01655468's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Dim pass = txtPass.Text Dim user = txtUser.Text Dim joinin As String joinin = user & "," & pass Dim swriter As IO.TextWriter swriter = IO.File.CreateText("E:\text.txt") swriter.Write(joinin) swriter.Close() MessageBox.Show("Text Saved") End Sub It override my previous contents in the text field, anyone know how to save it to the back of my previous content, not overide it. Thank in advance Forget about my previous question in the forms
  2. I try, but can't. It does not read and compare the value in the TextBox1 and 2 to the text file at E:\text.txt. Can help ============================================== Dim sPassArray() As String Dim pass = TextBox1.Text Dim user = TextBox2.Text Dim eii As String Dim i As Integer Dim ei As String Dim sreader As IO.StreamReader sreader = IO.File.OpenText("E:\text.txt") ei = sreader.ReadToEnd sreader.Close() sPassArray = Split(eii, ",") For i = 0 To UBound(sPassArray) Step 2 If sPassArray(i) = pass Then If sPassArray(i + 1) = user Then End If End If Next
  3. 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]
×
×
  • Create New...