Click here to Skip to main content
12,954,001 members (44,478 online)
Rate this:
Please Sign up or sign in to vote.
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:
<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:
 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
    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 15-Nov-12 18:24pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
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 2010.

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,464
CHill60 3,490
Maciej Los 3,123
ppolymorphe 2,020
Jochen Arndt 1,975

Advertise | Privacy | Mobile
Web01 | 2.8.170525.1 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100