我是winfrom程序private void button1_Click_1(object sender, EventArgs e)
{
WebBrowser webBrowser2 = new WebBrowser();
webBrowser2.Navigate("http://www.baidu.com");
string aa = webBrowser2.Document.Cookie;
textBox1.Text = aa;
}执行的时候“string aa = webBrowser2.Document.Cookie;”提示错误
说“未将对象引用设置到对象的实例。”不知道是什么问题!我明显new了!
{
WebBrowser webBrowser2 = new WebBrowser();
webBrowser2.Navigate("http://www.baidu.com");
string aa = webBrowser2.Document.Cookie;
textBox1.Text = aa;
}执行的时候“string aa = webBrowser2.Document.Cookie;”提示错误
说“未将对象引用设置到对象的实例。”不知道是什么问题!我明显new了!
你需要在webbrowser加载网页完成之后再取
在 webBrowser.DocumentComplete 中写
string aa = webBrowser2.Document.Cookie;
textBox1.Text = aa;
往表单上拖一个webbrowser看看设计器怎么创建窗口的