Hello guys i'm getting a massive memory leak which over period of 1min its increase alot and always increases.
How to i prevent the memory stacking? I looked all around the internet as im not just posting coz im lazy, i cant find a solution for my code.
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If TextBox3.Text = String.Empty Then
MessageBox.Show("Please enter a subject", "Subject Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
If TextBox3.Text = String.Empty Then Exit Sub
If TextBox4.Text = String.Empty Then
MessageBox.Show("Please enter a message", "Message Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
If TextBox4.Text = String.Empty Then Exit Sub
If TextBox5.Text = String.Empty Then
MessageBox.Show("Please enter start ID to PM", "Start ID Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
If TextBox5.Text = String.Empty Then Exit Sub
If TextBox6.Text = String.Empty Then
MessageBox.Show("Please enter end ID to PM", "End ID Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Dim abc As Integer
Dim X As Integer
X = -1
If TextBox6.Text = String.Empty Then Exit Sub
For abc = TextBox5.Text To TextBox6.Text Step 1
WebBrowser1.ScriptErrorsSuppressed = True
WebBrowser1.Navigate("http://forum.ea.com/uk/pm/sendTo/" & abc & ".page")
WebBrowser1.ScriptErrorsSuppressed = True
While WebBrowser1.ReadyState <> WebBrowserReadyState.Complete
Application.DoEvents()
End While
X = X + 1
Label4.Text = abc
Label7.Text = X
Me.Refresh()
Try
WebBrowser1.Document.GetElementById("subject").SetAttribute("value", TextBox3.Text)
WebBrowser1.Document.GetElementById("message").SetAttribute("value", TextBox4.Text)
WebBrowser1.Document.GetElementById("btnSubmit").InvokeMember("click")
Catch ex As Exception
X = X - 1
End Try
While WebBrowser1.ReadyState <> WebBrowserReadyState.Complete
Application.DoEvents()
End While
Threading.Thread.Sleep(2000)
Next abc
End Sub