|
-
Feb 5th, 2013, 01:18 PM
#1
Thread Starter
New Member
VS2010 - IP Monitor Program Question
Hey guys. I'm trying to build a program that can tell me if Lan, Wan1, and Wan2 are up or down on each of our offices. The Office and IP information are coming from a text file and I'm using listview to display the office and IPs. The format of the text file is like this:
San Jose, 192.x.x.x, 66.x.x.x, 209.x.x.x
San Francisco, 192.x.x.x, 66.x.x.x, 209.x.x.x
Sacramento, 192.x.x.x, 66.x.x.x, 209.x.x.x
Now what I want is for the IP font color to be green if there is network connection and it turns red if there is no network connection. I was wondering if you guys can give me some pointers on how I can achive this. Thanks.
Code:
Dim Office As String
Dim Lan As String
Dim Wan1 As String
Dim Wan2 As String
Try
Dim sr As StreamReader
Dim fs As FileStream
fs = New FileStream(("C:\offices.txt"), FileMode.OpenOrCreate)
sr = New StreamReader(fs)
Dim itm As Object
itm = sr.ReadLine
While Not itm = Nothing
Dim split As String() = itm.split(New [Char]() {","})
Office = split(0)
Lan = split(1)
Wan1 = split(2)
Wan2 = split(3)
lvMain.Items.Add(Office)
lvMain.Items(lvMain.Items.Count - 1).SubItems.Add(Lan)
lvMain.Items(lvMain.Items.Count - 1).SubItems.Add(Wan1)
lvMain.Items(lvMain.Items.Count - 1).SubItems.Add(Wan2)
itm = sr.ReadLine
End While
sr.Close()
fs.Close()
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message, "Load Tool Data Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|