Sinisterly
OpenVPN GUI - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Visual Basic & .NET Framework (https://sinister.li/Forum-Visual-Basic-NET-Framework)
+--- Thread: OpenVPN GUI (/Thread-OpenVPN-GUI--53214)



OpenVPN GUI - alaa92 - 12-28-2013

Hi

How are you?

I was make OpenVPN GUI with VB.net
How i can read text file(log.txt) line by line and put it into textbox and keep it update when (log.txt) changed



RE: OpenVPN GUI - shirofuji - 12-30-2013

You would need a timer that would keep the textbox updated
add a timer to your form, set interval to any number of milliseconds you desire and set enabled=true

add this code to the very beginning
Code:
Imports System.IO

this should be the code of your timer.
this would work if your logs.txt file is within the same directory. if you wish to put logs.txt into other directory. you should specify its path. example:
if you want it in c:/ change "logs.txt" to "c:/logs.txt"
Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim textStream as StreamReader textStream=New StreamReader("logs.txt",True) TextBox1.Text=textStream.ReadToEnd End Sub



RE: OpenVPN GUI - ArkPhaze - 01-01-2014

And as commonly expected, another example of an underlying Stream not being disposed. Methods like Close() and Dispose() exist for a reason for classes that implement the IDisposable interface.