ive created a function for generating username, password, email to log in on a website but the problem is i want to use all account one at a time for example

num|username|email|passwd
1|username1|email@email1.com|password1
2|username2|email@email2.com|password2
3|username3|email@email3.com|password3
4|username4|email@email4.com|password4
5|username5|email@email5.com|password5

log in 1st acct ... do something then logout... then log in 2nd acct... do something then logout.... so on so fort...

heres my code function for generating random...

Public Sub GenerateNames1(ByRef file As String)
        Dim Random As New Random
        Dim RndmResult As Integer
        RndmResult = Random.Next(2, 12)
        'read random line

        Dim Details As String = ReadLine(file, RndmResult)
        Dim DetailsArray() As String = Details.Split("|")
        uname = DetailsArray(1)
        email = DetailsArray(2)
        passwd = DetailsArray(3)
    End Sub

how can i do it one at a time?

thx in advance! :D

>how can i do it one at a time?

...
Dim s As String() = System.IO.File.ReadAllLines("file.txt")(rndVal).Split("|")
...

thx for your replay i solve this by creating a function

Public Function CountLinesInFile(ByVal strFilePath As String) As Integer
        Dim lc As Integer = 0
        If Not File.Exists(strFilePath) Then
            MsgBox("File: " & strFilePath & _
             " hasn't been downloaded yet. Preprocessing is being aborted.", _
            MsgBoxStyle.OKOnly, "File Does Not Exist")
        End If
        Try
            Dim sr As StreamReader = New StreamReader(strFilePath)
            While Not IsNothing(sr.ReadLine)
                lc += 1
            End While
            sr.Close()
        Catch
            MsgBox("File: An error occurred while reading " & strFilePath & _
            ". Preprocessing is being aborted.", MsgBoxStyle.OKOnly, "File Read Error")
            lc = -1
        End Try
        Return lc
    End Function

I'm glad you got it working. Please mark this thread as solved if you have found an answer to your question and good luck.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.