我想写个winform程序往网页插入值
思路是:
设置20个常量,将这20个常量插入集合里面,启动程序的时候 将常量循环从数组中取出,再向网页输出(重点,不知道用winform程序怎么向网页里面插入文本,有点外挂的感觉),可以设置输出值的时候键盘用CTRL解发输入事件。不知道可行不,主要就是向网页里面输入值不会。有大大帮我编个么,感激不尽

解决方案 »

  1.   

    可以
    比如下面这个winform程序可以回复csdn,在textbox里粘贴进帖子的地址,比如现在这个帖子
    http://topic.csdn.net/u/20091201/14/435044e4-ca82-4610-98a4-ddb1a464cb18.html?30888
    然后回车
    然后通过2次导航自动定位到回复页,最后点击最下面的“写回复”按钮就知道填好回复了
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace WindowsApplication181
    {
        public partial class Form1 : Form
        {
            TextBox TB = new TextBox();
            Button B = new Button();
            WebBrowser WB = new WebBrowser();        bool IsReplyFrame = false;        public Form1()
            {
                InitializeComponent();            this.Size = new Size(800, 800);
                this.StartPosition = FormStartPosition.CenterScreen;            TB.Parent = this;
                TB.Dock = DockStyle.Top;
                TB.KeyDown += new KeyEventHandler(TB_KeyDown);            B.Parent = this;
                B.Dock = DockStyle.Bottom;
                B.Click += new EventHandler(B_Click);
                B.Text = "写回复";            WB.Parent = this;
                WB.Dock = DockStyle.Fill;
                WB.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(WB_DocumentCompleted);
            }        void TB_KeyDown(object sender, KeyEventArgs e)
            {
                IsReplyFrame = false;            if (e.KeyCode == Keys.Enter)
                    WB.Navigate(TB.Text);
            }        void WB_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
            {
                if (!IsReplyFrame)
                {
                    String RelayUrl = WB.Document.GetElementById("replyframe").GetAttribute("src");                WB.Navigate(RelayUrl);
                    IsReplyFrame = true;
                }
            }
     
            void B_Click(object sender, EventArgs e)
            {
                WB.Document.GetElementById("tb_ReplyBody$_$Editor").InnerText = "回复!!!!!!";
            }
        }
    }
      

  2.   

    上面的就是测试帖,winform里回复的
      

  3.   

    不太理解往网页里输入值什么意思,如果在winfrom上操作的话用webBrowser控件加载网页,然后有很多种方法输入值。
      

  4.   

    我是泥 马 党的
    用webBrowser完全可以实现你的需求
      

  5.   

    往网页插入值? 太模糊了, 如果是说自己生成 html 文件倒也好理解一点ps. 我是啥党...
      

  6.   

    wartim  感谢  等会我试下