我用Winform+webBrowser做了个程序,就是打开网页(网页是未知的),加载网页上所有的select(下拉列表),然后显示在Winform程序上 但是我没有思路 希望大家帮个忙啊!

解决方案 »

  1.   

                IList<string> iurl = new List<string>();
                iurl.Add("http://www.cnblogs.com/");
                iurl.Add("http://www.tzscn.com/");
                iurl.Add("http://www.xinhuanet.com/");
                iurl.Add("http://cn.msn.com/");
                iurl.Add("http://www.sina.com.cn/");
                iurl.Add("http://www.pconline.com.cn/");
                iurl.Add("http://blog.csdn.net/");
                iurl.Add("http://www.qunar.com/");
                iurl.Add("http://www.ftchinese.com/");
                iurl.Add("http://cn.wsj.com/gb/");
                iurl.Add("http://news.ifeng.com/?_fs");
                iurl.Add("http://www.51nb.com/");
                iurl.Add("http://www.taobao.com/");
                iurl.Add("http://www.csdn.net/");
                iurl.Add("http://www.chinaprice.gov.cn/fgw/chinaprice/free/index.htm");            comboBox1.Items.AddRange(iurl.ToArray<string>());
                comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                comboBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
                comboBox1.AutoCompleteCustomSource.AddRange(iurl.ToArray<string>());  //窗体加载时添加如下代码,控件为Commbox。        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                webBrowser1.Url = new Uri((sender as System.Windows.Forms.ComboBox).Text);
                  
            }//SelectedIndexChanged事件,选中则导向该页面了。
      

  2.   

    通过 webBrowser.Document获取网页内容,再遍历所有select
      

  3.   


    但是不知道 一个页面有多少个select啊 因为页面不一样啊!
      

  4.   

    人家都说是遍历了你咋还问呢,遍历跟循环的区别还分不清楚?遍历是不需要知道有多少个的,循环是需要知道的笨,其实用循环也行,你要去按照楼主说的研究一下方法就懂了,这个东西我做过,我在给注册QQ的网站上赋值了~
    他把控件名都JB隐藏了
    我就用这招搞的