Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#在WebBrowser控件中选中/取消选中复选框?_C#_Html_Winforms_Webbrowser Control - Fatal编程技术网

C#在WebBrowser控件中选中/取消选中复选框?

C#在WebBrowser控件中选中/取消选中复选框?,c#,html,winforms,webbrowser-control,C#,Html,Winforms,Webbrowser Control,这是我的代码: webBrowser1.Document.GetElementById("user").SetAttribute("value", txtUsername.Text); webBrowser1.Document.GetElementById("pass").SetAttribute("value", txtPassword.Text); webBrowser1.Document.GetElementById("rememberme").SetAttribute("checked"

这是我的代码:

webBrowser1.Document.GetElementById("user").SetAttribute("value", txtUsername.Text);
webBrowser1.Document.GetElementById("pass").SetAttribute("value", txtPassword.Text);
webBrowser1.Document.GetElementById("rememberme").SetAttribute("checked", cbAutoLogin.Checked.ToString());
用户名和密码没问题,我没有任何问题,但检查不起作用。问题不在cbAutoLogin.Checked.ToString()上,即使我写的是true或false,也没有任何变化

这是html上的复选框

<input type='checkbox' id='rememberme' checked='checked' name='rememberme' value='1' class='input_check' />

还有其他人有同样的问题吗?或者我做错了什么?

使用以下方法:

webBrowser1.Document.GetElementById("rememberme").InvokeMember("CLICK");
如果未选中,将使其处于选中状态,如果选中,将使其处于未选中状态


或者将与username、password相同的value属性更改为0或1。

我看到的第一件事是需要在输入中添加runat=“server”element@astroboyWinForms:-)标题也让我措手不及。@pst。哎呀。下次我应该把整个问题和标签一起读。