小弟之前在窗体的多线程内调用控件,使用:
System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
这条语句,网上好像都不建议这么使用,唉,本人用这种方式调试程序也报错,实在没辙,就采用了另外一种网上认为稍微优化点儿的方式,如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Threading;
namespace WindowsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Thread threadGet1, threadGet2;
threadGet1 = new Thread(new ThreadStart(doGetFromXml1));
threadGet2 = new Thread(new ThreadStart(doGetFromXml2));
threadGet1.St