Click here to Skip to main content
Rate this: bad
good
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
        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 15-Nov-12 19:24pm
v2

1 solution

Rate this: bad
good
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.
  Permalink  
Comments
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 Basic.net 2010.

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



Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2014
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