Dim line(10000) As String
Dim log_ctr As Integer
Open App.Path & "\data\log.txt" For Input Lock Read As #1
Do Until EOF(1)
Line Input #1, line(log_ctr)
log_ctr = log_ctr + 1
Loop
Close #1
If last_log <> log_ctr Then
For n = last_log To log_ctr - 1
Text1.SelStart = Len(Text1.Text)
Text1.SelText = line(n) & vbCrLf
End if
Next
last_log = log_ctr
End If

Can someone help me convert/translate this to VB 2010. Thank you very much.

Dim line As String = String.Empty
        Dim log_ctr As Integer = 0
        Dim readData As New System.IO.StreamReader("\data\log.txt")

        While readData.Read
            log_ctr += 1
        End While

        readData.Dispose()

        If last_log <> log_ctr Then
            For n = last_log To log_ctr - 1
                text1.SelectionStart = text1.Text.Length
            Next
        End If

Well this what I managed

1. last_log is never defined
2. What are u trying to do with line 12 in your code


Atleast define the problem a little so i can help u with more efficient code :)

@ Ankit, thank you very much for the reply and help
I was able to convert it using my friend "Google".
this script is part of my project for OpenVPN GUI, it should display the logs to a text box. but you can help me though on a pinger that will display the result in a text box in my form.

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.