Click here to Skip to main content
15,900,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all! First off, I'd like to say thanks for any help in advance, it's much appreciated!

So basically i have this form, I've got everything good so far as textboxes go, but this is what the html code looks like on the page:
HTML
<td><input type="radio" name="pw" value="yes" />Yes   <input type="radio" name="pw" value="no" />No</td>

I can't modify the page whatsoever, so that's out of the question. Here's my piece of the code:
VB
 Dim theElementCollection As HtmlElementCollection = frmMain.wbOffScreen.Document.GetElementsByTagName("Input")
        For Each curElement As HtmlElement In theElementCollection
            Dim controlName As String = curElement.GetAttribute("name").ToString 
If controlName = "pw" Then
            
curElement.SetAttribute("Checked", "yes")
            End If
        Next
    End Sub

Each time I load this, it selects "No" Which is the opposite of what I need to hear her say. :/
Once again thanks for any help!
Posted
v2

1 solution

I recommend you use the RadioButtonList for this task. Secondly if you want Yes to be selected when page loads then do that inside page_load when ispostback is false.
 
Share this answer
 
Comments
aaron1312 16-Nov-12 21:40pm    
I'm not quite sure I understand what you mean, I'm trying to modify a page within the web browser control. Also, I'm using Visual Basic.net 2010.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900