我刚入门,想找一程序学习,在网上下载了个c#的程序webFinder.zip,可是运行不起,调试过好象发现是线程有问题,想请大家帮忙解决下在单步调试时出现了如下错误
未处理的“System.Threading.ThreadStopException”类型的异常出现在 system.windows.forms.dll 中。其他信息: 线程正被停止。请各位大哥大姐帮忙看下啊
未处理的“System.Threading.ThreadStopException”类型的异常出现在 system.windows.forms.dll 中。其他信息: 线程正被停止。请各位大哥大姐帮忙看下啊
解决方案 »
- 一个winfrom程序,主要功能通过链接库实现
- c#是区分大小写的呀,为何 new String() 与 new string() 效果完全相同呢?
- web页如何开启本地exe文件?
- 关于固定datalist行高的问题
- 关于进程的问题Process.Start() 同样的代码为什么在windows的程序里面可以,但是在asp.net下就不可以了呢?
- datatable中的内容导出到excel中结尾乱码的问题
- 在c#中如何关闭进程。
- 急求解答,在线等待!!!
- Remoting中访问安全问题
- c#中结构数组怎么定义?怎么获取一个字符的ascii码?
- 线程同步问题
- 多线程中修改listview的SubItem
他是winform的程序,就需要system.windows.forms.dll 的dll
你可以重新添加一下应用,这个dll是系统自带的。
private void begin_Click(object sender, System.EventArgs e)
{
ThreadStart starter = new ThreadStart(this.SpiderThread);
Thread spider = new Thread(starter);
spider.Start();
} public void SpiderThread()
{
if( begin.Text.Equals("Cancel") )
{
m_spider.Quit = true;
begin.Enabled = false;
}
else
{
begin.Text = "Cancel";**************
targetURL.Enabled = false;******************
threadCount.Enabled = false;
outputDir.Enabled = false; m_spider = new Spider();
m_spider.ReportTo = this;
m_spider.OutputPath = outputDir.Text;
int threads = int.Parse( threadCount.Text);
if(threads<1)
threads = 1;
threadCount.Text = ""+threads;
try
{
m_spider.Start(new Uri(this.targetURL.Text),threads);
}
catch( UriFormatException ex)
{
System.Windows.Forms.MessageBox.Show( ex.Message );
return;
} begin.Text = "Begin";
targetURL.Enabled = true;
threadCount.Enabled = true;
outputDir.Enabled = true;
begin.Enabled = true;
} }
{
ThreadStart starter = new ThreadStart(this.SpiderThread);//调用下面那个过程SpiderThread()
Thread spider = new Thread(starter);
spider.Start();
} public void SpiderThread()
{
if( begin.Text.Equals("Cancel") )
{
m_spider.Quit = true;
begin.Enabled = false;
}
else
{
begin.Text = "Cancel";
targetURL.Enabled = false;//执行到这步,就报帖子上的错误了
threadCount.Enabled = false;
outputDir.Enabled = false; m_spider = new Spider();
m_spider.ReportTo = this;
m_spider.OutputPath = outputDir.Text;
int threads = int.Parse( threadCount.Text);
if(threads<1)
threads = 1;
threadCount.Text = ""+threads;
try
{
m_spider.Start(new Uri(this.targetURL.Text),threads);
}
catch( UriFormatException ex)
{
System.Windows.Forms.MessageBox.Show( ex.Message );
return;
} begin.Text = "Begin";
targetURL.Enabled = true;
threadCount.Enabled = true;
outputDir.Enabled = true;
begin.Enabled = true;
} }
一种是调试的时候用单线程调试
第二种是 把begin.Text = "Cancel"; 改成 this.begin.Text = "Cancel";
把后面的控件前面都加上(this.) 就可以了