I am trying to make a software that signs up for hotmail etc. I am running into a couple of problems with the choosing of the birth date and clicking the submit button. I am newer to coding.


So here is my code I have tried so it will enter the birthdate on hotmail but it is not working and I do not know why:

WebBrowser1.Document.GetElementById("iBirthMonth").InvokeMember("Value" = "3")

And I was wondering if anybody knew what code would be used to click the submit button?

It should not need an ID for it to click the submit button.
If it does not work, try changing the 1 to a 0, even a 2 If needed.

WebBrowser1.Document.Forms(0).InvokeMember("submit")

It should not need an ID for it to click the submit button.
If it does not work, try changing the 1 to a 0, even a 2 If needed.

WebBrowser1.Document.Forms(0).InvokeMember("submit")

Ok thank you I changed it to a 0 and it worked and would there be a way to set a timer on it so it won't just go rapidly?

Check out this post.

Thanks for all your help so far the next problem I have run into is that there is a check box that you have to click to check and I have no idea how I would have it check do you know what I could use? here is the inspect element for it http://screensnapr.com/v/oHgKHJ.png

Easy since I do some HTML'ing on the side. Actually I should not have mentioned that since I am slacking on updating my web.sight.:D

With WebBrowser1
            With .Document
                .GetElementById("agree").SetAttribute("checked", "checked")
            End With
        End With

Easy since I do some HTML'ing on the side. Actually I should not have mentioned that since I am slacking on updating my web.sight.:D

With WebBrowser1
            With .Document
                .GetElementById("agree").SetAttribute("checked", "checked")
            End With
        End With

Ok now I want to get the captcha in an image box so it can be seen without looking into the browser how would I do that? I have the inspect element image here http://screensnapr.com/v/2TN9Sq.png and I also wanted to create a text box so you can type the captcha in the text box and it will go into the browser. Thanks for your help.

To load an online image into a PictureBox, use this.

PictureBox1.ImageLocation = "http://images.daniweb.com/logo.gif"

The only problem with that is that the link to the catpcha changes every time you create a new account.

I managed to get some "noob".results:D towards getting the captcha.img.

Imports System.IO
Public Class Form1
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        With WebBrowser1
            .Navigate("https://signup.live.com/signup.aspx?lic=1")
        End With
    End Sub

    Private Sub WebBrowser1_DocumentCompleted(sender As System.Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        setCaptchaImage(PictureBox1)
    End Sub

    Private Sub setCaptchaImage(ByVal selPictureBox As PictureBox)
        For Each itm As String In Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache), "*.jpg", IO.SearchOption.AllDirectories)
            If Path.GetFileNameWithoutExtension(itm).StartsWith("image") Then
                selPictureBox.ImageLocation = itm
            End If
        Next
    End Sub
End Class

Basically, it looks into the InternetCache folder, locates the ".jpg" images and since the captchas save as filenames "image[1],image[2],etc.", I got it to run thru all files and keep loading the image until the last image in folder. Somewhat noob, though it works for a start.up.

This seems to work well when you clear the cache of IE and it does seem to not always (about 25% of the time) refresh the directory files, returning the previous captcha image.

However, with this noob.result, I am happy to get you going in the right direction.:)
.I do however have some notes to go along w/you.
1.Check image's FileInfo for creationTime and if less than a few seconds from you loading the page, more than likely it is the appropriate captcha.image.
2.Find a way to refresh the InternetCache folder, to return the most recent images.
3.Good luck.:)

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.