I have created Sub in VB.net application, Which reads a text file contents.
Expand|Select|Wrap|Line Numbers
- Sub IPsetter()
- Dim fileName As String
- Dim realIParray As String() = Nothing
- Dim ipString As String
- fileName = "D:\IPFinder\WWIP\ip.txt"
- Try
- Dim stream As StreamReader
- stream = New StreamReader(fileName)
- ipString = stream.ReadToEnd()
- realIParray = ipString.Split(":")
- Dim realIP As String = realIParray(1).ToString
- SetNewIP(realIP)
- Catch exceptionCatch As IOException
- lbl_ip.Text = "Error Detected"
- End Try
- End Sub
Expand|Select|Wrap|Line Numbers
- Private Sub IPFinder_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- IPsetter()
- End Sub
Example:
When I execute the Form for the first time IP address will read from the text file and Display it in the lbl_ip. Here after, I am not going to close this form. while the form is running the text file contents might updating. so when its updating I need display the same value in Label.
My Idea is to call for IPFinder_Load Sub with Intervals, No Idea about doing such a thing. Any Suggestions?
Thanks!