zoukankan      html  css  js  c++  java
  • C#单线程演示程序带参数

    源代码:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Diagnostics;
    using System.Net;
    using System.Threading;

    namespace WindowsFormsApplication13
    {
        public partial class Form1 : Form
        {
           
            p rivate String html1 = null;
            public String Html1
            {
                get { return this.html1; }
                set { this.html1 = value; }
            }

            public Form1()
            {
                InitializeComponent();
            }

            p rivate void button1_Click(object sender, EventArgs e)
            {
                Thread myThread1;
                myThread1 = new Thread(readwebsite);
                myThread1.Start((object)textBox1.Text);
            }

            p rivate void readwebsite(object url)
            {
                this.Html1 = gethtml((String)url);
                MethodInvoker mi = new MethodInvoker(richtextbox_invokefun);
                this.BeginInvoke(mi);
            }

            p rivate String gethtml(String url)
            {
                WebClient web1 = new WebClient();
                byte[] data1= web1.DownloadData(url);
                String html=Encoding.Default.GetString(data1);
                return html;
            }

            p rivate void richtextbox_invokefun()
            {
                richTextBox1.Text =this.Html1;
            }
        }
    }
     

    源代码下载

  • 相关阅读:
    2.HTML案例二 头条页面
    1.HTML入门
    33.1.网络编程入门
    32.原子性
    【转】风控中的特征评价指标(一)——IV和WOE
    【转】Python调用C语言动态链接库
    基于蒙特卡洛树搜索(MCTS)的多维可加性指标的异常根因定位
    正则表达式全集
    基于ray的分布式机器学习(二)
    基于ray的分布式机器学习(一)
  • 原文地址:https://www.cnblogs.com/hackpig/p/1668477.html
Copyright © 2011-2022 走看看