Goedkoopste Kopen Goedkoopste Kopen - 2 months ago 7
Vb.net Question

Code does not run on second attempt

The program runs from a button and loads the XMLHTTP GET request.

The first time the button is clicked, it works.

When I click it after the first time, nothing happens.

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim oXMLHTTP
Dim oStream

oXMLHTTP = CreateObject("MSXML2.XMLHTTP.3.0")

oXMLHTTP.Open("GET", "http://test.com/ricky.php", False)
oXMLHTTP.Send()

End Sub

Answer

I believe you need to close oXMLHTTP like so:

oXMLHTTP.Close()

So the full method would be:

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    Dim oXMLHTTP
    Dim oStream

    oXMLHTTP = CreateObject("MSXML2.XMLHTTP.3.0")

    oXMLHTTP.Open("GET", "http://test.com/ricky.php", False)
    oXMLHTTP.Send()
    oXMLHTTP.Close()
End Sub