任何线索如何解决此错误?
void wb_LoadCompleted(object sender, NavigationEventArgs e)
{
var doc = (mshtml.HTMLDocument)wb.Document;
HTMLHeadElementClass head = (HTMLHeadElementClass)((IHTMLElementCollection)doc.all.tags("head")).item(null, 0); // Error
IHTMLScriptElement scriptObject = (IHTMLScriptElement)doc.createElement("script");
scriptObject.type = @"text/javascript";
scriptObject.text = @"function btn1_OnClick(str){alert('you clicked' + str);}";
head.appendChild((IHTMLDOMNode)scriptObject);
}