Hi all,

I have a question about moving through the elements in a web browser via C#. I currently am trying to get a checkbox to become unchecked using the HtmlElementsCollection...
I have so far been able to implement putting text into a message box that is on a webpage, but I cannot figure out the right syntax for unchecking a checkbox. This is what I've tried so far (the first one is the message box, it works. Second one is the checkbox...no luck):

HtmlElement addMsg = this.webBrowser1.Document.All[gc_inviteFriendMsgBox];
                addMsg.SetAttribute("value", "Heya, I totally worked!");

                HtmlElement actStream = this.webBrowser1.Document.All[gc_inviteActivityBox];
                actStream.SetAttribute("checked", "unchecked");

Instead of "unchecked" I have tried 0 and false...any help here? =\ I have huge troubles with MSHTML when I tried to implement that...kept saying I need a reference to an object with the new keyword but every time I tried that it would say I can't...


Edited by jeeter19: n/a

8 Years
Discussion Span
Last Post by __avd

Since the SetAttribute method sets the value of the name, you wouldn't want the value for "checked" to be "unchecked" because it expects a state flag value for a checkbox's state. Have you tried: SetAttribute("checked", "false") ?

Edited by DdoubleD: n/a


Welcome tongriff.

Please do not resurrect threads that are years old. By doing so you run the risk of confusing current posters and/or reopening old wounds.

Thread Closed.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.