View Full Version : Need to write to Text File

09-10-2014, 09:46 PM
Im creating a Application to detect internet connection. Upon Disconnection i want to write to a .txt file with out pushing a button

Here is My code so far:

ublic Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer2.Enabled = True
End Sub

Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If System.Net.NetworkInformation.NetworkInterface.Get IsNetworkAvailable = True Then
Label1.Text = "Connected to The Internet"
TextBox1.Text = "Connected to Internet"
ElseIf System.Net.NetworkInformation.NetworkInterface.Get IsNetworkAvailable = False Then
Label1.Text = "Disconnected From Internet"
TextBox1.Text = "Disconnected From Internet"
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer2.Tick
TextBox2.Text = TimeOfDay
End Sub
End Class

Basic Lable1 says Connected or Disconected
same as TextBox1
TextBox 2 is a clock

I want to output to file on TextBox1 Change

so itl say mm/dd/yy - hh:mm Connected/Disconected.

i can use Dim Write as New for a button click,
But what would it be for a Form1 Events Text Changed?

09-10-2014, 11:19 PM
Bleh, Visual Basic is redundant. Didn't know we had a section for it. >.>

Anyway, read this: