Login Register






OpenVPN GUI filter_list
Author
Message
OpenVPN GUI #1
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

Reply

RE: OpenVPN GUI #2
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

Reply

RE: OpenVPN GUI #3
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.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply