954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Code not working

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?

daydie
Junior Poster in Training
68 posts since Jan 2012
Reputation Points: 22
Solved Threads: 0
 

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.

Reverend Jim
Posting Shark
Moderator
1,167 posts since Aug 2010
Reputation Points: 253
Solved Threads: 159
 

i put

Dim X As Integer


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

daydie
Junior Poster in Training
68 posts since Jan 2012
Reputation Points: 22
Solved Threads: 0
 

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

daydie
Junior Poster in Training
68 posts since Jan 2012
Reputation Points: 22
Solved Threads: 0
 

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
daydie
Junior Poster in Training
68 posts since Jan 2012
Reputation Points: 22
Solved Threads: 0
 

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.

Reverend Jim
Posting Shark
Moderator
1,167 posts since Aug 2010
Reputation Points: 253
Solved Threads: 159
 
Label4.Text = X.ToString()
thines01
Postaholic
Team Colleague
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
 

"Code not working"?
.you making fun of me? :D

Since I recently posted to your other thread, hope it clarifies this one.:)
http://www.daniweb.com/software-development/vbnet/threads/408271/1743532#post1743532

codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: