Change Value on a website via VB

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
4 posts Page 1 of 1
Contributors
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Hello.

I am attempting to make a tiny little program for a college challange to auto fill in a form online i have done fine with text using this code but now i have to select an item from a combobox and i attempted to do it in the same manior with the code below
Code: Select all
        Dim buying As HtmlElement = WebBrowser1.Document.All.Item("type")
        buying.InnerText = ComboBox1.Text
it does not seem to work though does anyone know how to do this please :)
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

I would try this:
Code: Select all
Dim buying As HtmlElement = WebBrowser1.Document.All.Item("type")
buying.SetAttribute("value", ComboBox1.Text)
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Thank you but this does not work, it just changes it to blank text
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

going to keep this post open for a wee bit as their may be a more efficant way to do this but thanks to your post i just figured out what i did wrong thank you. here is the working code
Code: Select all
        Dim buying As HtmlElement = WebBrowser1.Document.All.Item("type")
        If ComboBox1.Text = "Buying" Then
            buying.SetAttribute("value", "0")
        Else
            buying.SetAttribute("value", "1")
        End If
4 posts Page 1 of 1
Return to “Coding Help & Support”