View Single Post
  #18 (permalink)  
Old January 7th, 2005, 09:06 AM
rhysduk rhysduk is offline
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to rhysduk Send a message via Yahoo to rhysduk
Default

I modifies your code that you agve me to this:

Code:
Private Sub Command2_Click()

    Dim TextLine$, Filename$
    Dim FileHandle As Integer
    Dim strUserName As String
    Dim strUserReg As Integer

    Filename$ = "Test.BAT"

    ' Test if the file exists
    If Dir(Filename$) = "" Then Exit Sub

    FileHandle = FreeFile ' This is safer than assigning a number
    Open Filename$ For Input As #FileHandle

    ' Initialize the user in case it's not found in the BAT file
    strUserName = "Not Found"

    Do While Not EOF(FileHandle)      ' Loop until end of file
        Line Input #FileHandle, TextLine$  ' Read line into variable
        If InStr(TextLine$, "=") > 0 Then
            strUserName = Mid(TextLine$, InStr(TextLine$, "=") + 2)
Do While Not EOF(FileHandle)      ' Loop until end of file
        Line Input #FileHandle, TextLine$  ' Read line into variable
        If InStr(TextLine$, "=") > 0 Then
            strUserReg = Mid(TextLine$, InStr(TextLine$, "=") + 2)

        End If
    Loop

        End If
    Loop

    Close #FileHandle
    Me.Label1.Caption = strUserName
    Me.Label2.Caption = strUserReg
End Sub
And it works perfectly.. Thanks a lot!

You're going in the credits section of the program :)

Reagrds
Rhys

Reply With Quote