Click here to Skip to main content
11,795,848 members (76,093 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: Windows VB.NET Forms
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 &nbsp&nbsp<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 at 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
0 Maciej Los 350
1 Sergey Alexandrovich Kryukov 326
2 KrunalRohit 239
3 Andy Lanng 236
4 OriginalGriff 230
0 OriginalGriff 1,852
1 Maciej Los 1,465
2 KrunalRohit 1,300
3 CPallini 840
4 Richard MacCutchan 828

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2015
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