I've made a small app that checks my IP adress like this:
It gives me what I need,but it takes about 10-15 sec to display the msgbox,so I decided to use a ProgressBar.But thats where my problems start.Code:Dim req As HttpWebRequest = WebRequest.Create("http://whatismyip.com/automation/n09230945.asp") Dim response As HttpWebResponse = req.GetResponse() Dim Stream As Stream = res.GetResponseStream() Dim sr As StreamReader = New StreamReader(Stream) MsgBox((sr.ReadToEnd()))
I set ProgressBar1.Minimum to 0,ProgressBar1.Value to 0,and ProgressBar1.Step to 1.
Since I do not know the Maximum value,I decided to use:
That way I can get the elapsed time and convert it to integer value.Code:Dim stoperica As New System.Diagnostics.Stopwatch
But the problem is I cannot use elapsed time,since I know it's value only after the stopwatch has stopped.Code:stoperica.Start() proteklo_vrijeme = stoperica.Elapsed.Seconds.ToString konverzija = Convert.ToInt32(proteklo_vrijeme) stoperica.Stop()
What can I do to make this work?


Reply With Quote