C# 如何每次在循环中等待webBrowser加载网页结束后执行某项操作之后,在继续循环?
privatevoidbtnYes_Click(objectsender,EventArgse){for(j=0;j<CheckFav_ur.Length;j++){we...
private void btnYes_Click(object sender, EventArgs e)
{
for (j = 0; j < CheckFav_ur.Length; j++)
{
webBrowser1.Navigate(CheckFav_ur[j]);
webBrowser1.DocumentCompleted+=new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
}
}
private void wb_DocumentCompleted(object sender, EventArgs e)//是当网页载入完毕后要进行的操作
{
CheckFav_na[j-1] = webBrowser1.DocumentTitle;
} 展开
{
for (j = 0; j < CheckFav_ur.Length; j++)
{
webBrowser1.Navigate(CheckFav_ur[j]);
webBrowser1.DocumentCompleted+=new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
}
}
private void wb_DocumentCompleted(object sender, EventArgs e)//是当网页载入完毕后要进行的操作
{
CheckFav_na[j-1] = webBrowser1.DocumentTitle;
} 展开
1个回答
展开全部
你第一个 btnYes 手动选择第一个或者默认选择第一个,然后在 completed里执行脊帆剩余咐孙的url 的 for 循环,最后
完成后使用: -= 卸载动作事件试樱简雹试
private void wb_DocumentCompleted(object sender, EventArgs e)
{
for() {
webBrowser1.Navigate(CheckFav_ur[j]);
}
webBrowser1.DocumentCompleted-=new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
}
完成后使用: -= 卸载动作事件试樱简雹试
private void wb_DocumentCompleted(object sender, EventArgs e)
{
for() {
webBrowser1.Navigate(CheckFav_ur[j]);
}
webBrowser1.DocumentCompleted-=new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询