以下のコードを実行すると、ブラウザが開き続けてしまいます。
ie.Quit(); をしているので本来は閉じないといけないのですが、、、


SHDocVw.InternetExplorer ie;
mshtml.IHTMLElementCollection mshtml_ec;
do
{
   ie = new SHDocVw.InternetExplorer();
string url = "http://yahoo.co.jp";;
ie.Navigate(url, null, null, null, null);
ie.Visible = true;
while (ie.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE || ie.Busy)
{
Application.DoEvents();
}

//検索ワードを入力
mshtml_ec = ie.Document.getElementsByTagName("input");
foreach (mshtml.IHTMLElement i_ele in mshtml_ec)
{
if (i_ele.getAttribute("id") != null)
{
string chk_id = i_ele.getAttribute("id");
if (chk_id == "srchtxt")
{
i_ele.setAttribute("value", "まんこ汁");
break;
}
}
}