Need some help from someone fluent in VB

Posts 1–2 of 2 · Page 1 of 1
Need some help from someone fluent in VB
My main issue is:

I have imported a text file with accounts

How do I split LINE by LINE via the keyword :

How do I import the SPLIT for example user[0] in TextBox1 and pass[0] in TextBox2 ?
Post a sample of what your input looks like.

If it's
USER:PASS
USER2:PASS2
USER3:PASS3

Then the following should work
Code:
Imports System
Imports System****

Class Test

    Public Shared Sub Main()
        Try
            Using sr As StreamReader = New StreamReader("TestFile.txt")
                Dim line As String
                While sr.EndOfStream = False
                    Dim tokens As String() = sr.ReadLine().Split(":")
                    Dim username As String = tokens(0)
                    Dim password As String = tokens(1)
                End While
            End Using
        Catch e As Exception
            Console.WriteLine("The file could not be read:")
            Console.WriteLine(e.Message)
        End Try
    End Sub

End Class
I converted this with an online converter from C#, because Visual Basic has terrible syntax, so I can't verify if this is working.
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us