hey guys this code is not working

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)  Handles Button3.Click 
        Do Until X = TextBox6.Text
            X = TextBox5.Text + 1
            Label4.Text = X
            Me.Refresh()
            WebBrowser1.Document.GetElementById("subject").SetAttribute("value", TextBox3.Text)
            WebBrowser1.Document.GetElementById("message").SetAttribute("value", RichTextBox1.Text)
            WebBrowser1.Document.GetElementById("btnSubmit").InvokeMember("click")
            WebBrowser1.Navigate("http://forum.ea.com/uk/pm/sendTo/" & X & ".page")
            ReaderTimer.Interval = 5000 ' In thousands of seconds
        Loop
    End Sub

I need it to auto increase amount, also wait on page load each time. or even better just post http content so i dont need to load page. It crashes on run, if i take the auto increment out it runs fine once. but that dont need page load

Any help?

Recommended Answers

All 7 Replies

You haven't declared X to be of any particular type. TextBox5.Text is a string and you are adding one to it so I presume that makes X an integer (assuming it is declared at the class level). In your Do Until statement you are comparing X (possibly an integer) to TextBox6.Text (definitely NOT an integer). These two things will never be equal.

i put

Dim X As Integer

at top of script also i do enter numbers in textbox5 and 6, but still does not work.

How can i make Textbox's ingegers? one to start from number and one to stop on number, also wait until page load?

would be really helpfull

here is my new code:

still no luck, it gets the number in textbox5 and adds one but stops and it kinda crashes again. do i need to put a page load wait on this?

Dim X As Integer
        Dim myint As Integer
        Dim myintt As Integer
        myint = CInt(Me.TextBox5.Text)
        myintt = CInt(Me.TextBox6.Text)
        Me.TextBox5.Text = System.Text.RegularExpressions.Regex.Replace(Me.TextBox5.Text, "[a-zA-Z.<>@ -+]", "")
        Me.TextBox6.Text = System.Text.RegularExpressions.Regex.Replace(Me.TextBox6.Text, "[a-zA-Z.<>@ -+]", "")
        Do Until X = myintt
            X = myint + 1
            Label4.Text = X
            WebBrowser1.Document.GetElementById("subject").SetAttribute("value", TextBox3.Text)
            WebBrowser1.Document.GetElementById("message").SetAttribute("value", RichTextBox1.Text)
            WebBrowser1.Document.GetElementById("btnSubmit").InvokeMember("click")
            WebBrowser1.Navigate("http://forum.ea.com/uk/pm/sendTo/" & X & ".page")
            Me.Refresh()
        Loop

i also have this code but this dont work either

Dim X As Integer
        Do Until X = CInt(TextBox6.Text)
            X = CInt(TextBox5.Text) + 1
            Label4.Text = X
            WebBrowser1.Document.GetElementById("subject").SetAttribute("value", TextBox3.Text)
            WebBrowser1.Document.GetElementById("message").SetAttribute("value", RichTextBox1.Text)
            WebBrowser1.Document.GetElementById("btnSubmit").InvokeMember("click")
            WebBrowser1.Navigate("http://forum.ea.com/uk/pm/sendTo/" & X & ".page")
            Me.Refresh()
        Loop

I can't help you with the web code but your code just above still has a problem. You declare X as Integer but thge first time through the loop it doesn't have a value. This is not good practice. You should declare it as (for example)

Dim X as Integer = 0

You will also get an error if TextBox6.Text cannot be converted to an Integer.

Label4.Text = X.ToString()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.