Private oInternet As Framework.Internet = Nothing Private oInternet2 As Framework.Internet = NothingIn the form Load() event, I have this:
oInternet = New Framework.Internet(oApp) oInternet2 = New Framework.Internet(oApp)Then, in a button of the form, I am issuing the startup of two timers where they each have a timer event including something like this:
' Get the URL oInternet.cUrl = LoadTestUrl.Text If Not oInternet.GetUrl() Then End If
' Get the URL oInternet2.cUrl = LoadTestUrl2.Text If Not oInternet2.GetUrl() Then End IfIn the Internet class, I have something like this (simplified here just for the basis of explaining the situation):
Public cHTML As String = "" Public oCookieContainer As System.Net.CookieContainer = New System.Net.CookieContainer ' Get the HTML response from a server Public Function GetUrl() As Boolean Dim lcUrl As System.Uri = Nothing Dim llSuccess As Boolean = False Dim loHttpWebRequest As System.Net.HttpWebRequest = Nothing Dim loStream As System.IO.Stream = Nothing Dim loString As System.IO.StreamReader = Nothing Dim loWebResponse As System.Net.WebResponse = Nothing ' Reset the values cHTML = "" ' Make it into a Uri lcUrl = New System.Uri(cUrl) ' Make it into a Web request loHttpWebRequest = System.Net.HttpWebRequest.Create(lcUrl) ' Assign the cookie container loHttpWebRequest.CookieContainer = oCookieContainer Try loWebResponse = loHttpWebRequest.GetResponse() loStream = loWebResponse.GetResponseStream() loString = New System.IO.StreamReader(loStream) cHTML = loString.ReadToEnd() llSuccess = True Catch loError As Exception cMessage = loError.Message End Try Return llSuccess End FunctionIf I only use one timer, thus sending only one URL in sequence, this works. As soon as I use two timers, they collapse on each other. Those are two instances of the class. Anyone knows why they would collapse on each other?