表格关闭时,流程不会消亡。 [英] Process won't die when form is closed.

查看:73
本文介绍了表格关闭时,流程不会消亡。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表单,显示使用VS2005

工具生成的DataGridView表。数据库是带有ODBC驱动程序的Pervasive v.9。


DataGridView效果很好,除非我完成后点击X关闭

.exe的形式拒绝死亡,必须在任务管理器中被杀死。


我运行调试跟踪,它似乎工作正常。我把一个关闭按钮放在

表格上,然后输入this.Close();因为它的事件,但我得到相同的

结果。


使用试用/错误故障排除似乎指向一些生成的
TableAdapter背后的
代码。如果我评论它表格正确关闭

但当然我的DataGridView不起作用。


任何人都有类似的问题?


我也有一个VS2005锁定问题(在另一个线程上)可能或可能

无关。


我的下一步是从头开始,因为一旦我查询了我的查询的截图等,重建

相当容易......


Edwin

解决方案

请尝试调用Application.Exit()。


如果有效,请检查line.Run()是否是你运行的
DataGridView的形式。


如果没有,请在调试模式下运行它。尝试关闭应用程序,然后在屏幕关闭后点击暂停

,看看你的代码卡在哪里。


" Edwin Smith" < sm ********** @aol.com???g???lilyó·s?D:uG************** @ TK2MSFTNGP05。 phx.gbl ...


>我有一个表单,显示使用VS2005
工具生成的DataGridView表。数据库是带有ODBC驱动程序的Pervasive v.9。


DataGridView工作得非常好,除非我完成后点击X来

关闭.exe拒绝死亡的形式,必须在任务

经理中杀死。


我运行调试跟踪,它似乎工作正常。我将一个关闭按钮

放到表格上,然后输入this.Close();因为它的事件,但我得到相同的

结果。


使用试用/错误故障排除似乎指向一些生成的
TableAdapter背后的
代码。如果我评论它表格正确关闭

但当然我的DataGridView不起作用。


任何人都有类似的问题?


我也有VS2005锁定问题(在另一个线程上)可能或

可能无关。


我的下一步是从头开始,因为一旦我查询了我的查询等屏幕,就很容易重建
...


Edwin



2月25日晚上9:15,Edwin Smith < smithgold ... @ aol.comwrote:


我有一个表单,显示使用VS2005

工具生成的DataGridView表。数据库是带有ODBC驱动程序的Pervasive v.9。


DataGridView效果很好,除非我完成后点击X关闭

.exe的形式拒绝死亡,必须在任务管理器中被杀死。


我运行调试跟踪,它似乎工作正常。我把一个关闭按钮放在

表格上,然后输入this.Close();因为它的事件,但我得到相同的

结果。


使用试用/错误故障排除似乎指向一些生成的
TableAdapter背后的
代码。如果我评论它表格正确关闭

但当然我的DataGridView不起作用。


任何人都有类似的问题?


我也有一个VS2005锁定问题(在另一个线程上)可能或可能

无关。


我的下一步是从头开始,因为一旦我查询了我的查询的截图等,重建

相当容易...



这听起来像是一个没有标记背景的后台线程。

只有当所有前台线程都停止执行时,应用程序才会关闭。如果你的代码启动了一个后台线程来执行一些长期运行的任务(比如从数据库中获取数据)并且没有
标记线程IsBackground。 ,然后线程将保持你的

应用程序活着。


你必须找到启动后台线程的代码和

确保线程的IsBackground属性设置为true。


当我在调试模式下运行它时它工作正常并正常退出。当然

应用程序没有在它自己的可执行文件中运行,然后它在调试器中运行所以

调试器没有告诉我什么的。


如果我在它自己的可执行文件中运行它,那么当我点击表格上的X或

时点击我添加的关闭按钮,表单关闭,但应用程序仍然在内存中运行

并且是orpahned。


我会查找后台线程 ;在其他回复中建议的问题

到我的帖子。


谢谢


Edwin


Lau Lei Cheong < le **** @ yehoo.com.hkwrote in message

news:OP ************** @ TK2MSFTNGP04.phx.gbl ...


请尝试调用Application.Exit()。


如果有效,请检查Application.Run()行是否有效是运行DataGridView的
格式。

如果没有,请在调试模式下运行它。尝试关闭应用程序,然后在屏幕关闭后点击暂停

,看看你的代码卡在哪里。


" Edwin Smith" < sm ********** @ aol.com>

??? g?ó?l¥ó·s?D:uG ******** ******@TK2MSFTNGP05.phx.g bl ...


>>我有一个表格,显示用
DataGridView工作得很好,除非我完成后点击X关闭表单.exe拒绝死了,必须在任务管理器中被杀死。

我运行了一个调试跟踪,似乎工作正常。我在表格上放了一个关闭按钮
并放入this.Close();为了它的事件,但我得到了相同的结果。

使用试用/错误故障排除似乎指向TableAdapter背后的一些生成的代码。如果我发表评论,表格会正确关闭
但当然我的DataGridView不起作用。

任何人都有类似的问题吗?

我'' m也有VS2005锁定问题(在另一个线程上),可能或者
可能没有关系。

我的下一步是从头开始,因为它很容易<一旦我有查询的截图等等,我就会重建...

Edwin




I have a form which displays a DataGridView table generated with the VS2005
tools. The database is a Pervasive v.9 with an ODBC driver.

The DataGridView works great except when I''m done and I click the X to close
the form the .exe refuses to die and has to be killed in Task manager.

I ran a debug trace and it seems to work fine. I dropped a CLOSE button onto
the form and put "this.Close();" in for it''s event but I get the same
result.

Using trial/error troubleshooting seems to point to some of the generated
code behind the TableAdapter. If I comment it out the form closes properly
but then of course my DataGridView doesn''t work.

Anyone have a similar problem?

I''m also having a VS2005 lockup problem (on another thread) which may or may
not be related.

My next step is to start over from scratch since it''s fairly easy to rebuild
once I have screenshots of my queries etc...

Edwin

解决方案

Try call Application.Exit() instead.

If it works, check the line Application.Run() whether it is the form your
DataGridView is running on.

If not, run it in Debug mode. Try closing the application and click Pause
after the screen goes off to see where your code stuck at.

"Edwin Smith" <sm**********@aol.com???g?ó?l¥ó·s?D:uG************ **@TK2MSFTNGP05.phx.gbl...

>I have a form which displays a DataGridView table generated with the VS2005
tools. The database is a Pervasive v.9 with an ODBC driver.

The DataGridView works great except when I''m done and I click the X to
close the form the .exe refuses to die and has to be killed in Task
manager.

I ran a debug trace and it seems to work fine. I dropped a CLOSE button
onto the form and put "this.Close();" in for it''s event but I get the same
result.

Using trial/error troubleshooting seems to point to some of the generated
code behind the TableAdapter. If I comment it out the form closes properly
but then of course my DataGridView doesn''t work.

Anyone have a similar problem?

I''m also having a VS2005 lockup problem (on another thread) which may or
may not be related.

My next step is to start over from scratch since it''s fairly easy to
rebuild once I have screenshots of my queries etc...

Edwin



On Feb 25, 9:15 pm, "Edwin Smith" <smithgold...@aol.comwrote:

I have a form which displays a DataGridView table generated with the VS2005
tools. The database is a Pervasive v.9 with an ODBC driver.

The DataGridView works great except when I''m done and I click the X to close
the form the .exe refuses to die and has to be killed in Task manager.

I ran a debug trace and it seems to work fine. I dropped a CLOSE button onto
the form and put "this.Close();" in for it''s event but I get the same
result.

Using trial/error troubleshooting seems to point to some of the generated
code behind the TableAdapter. If I comment it out the form closes properly
but then of course my DataGridView doesn''t work.

Anyone have a similar problem?

I''m also having a VS2005 lockup problem (on another thread) which may or may
not be related.

My next step is to start over from scratch since it''s fairly easy to rebuild
once I have screenshots of my queries etc...

This sounds like a background thread that isn''t marked "background".
The application shuts down only when all foreground threads have
stopped executing. If your code starts a background thread to do some
long-running task (like fetching data from a database) and doesn''t
mark the thread "IsBackground", then the thread will keep your
application alive.

You''ll have to find the code that starts the background thread and
ensure that the thread''s IsBackground property is set to true.


When I run it in debug mode it works fine and exits properly. Of course the
app doesn''t run in it''s own executable then, it''s running in the debugger so
the debugger doesn''t tell me anything.

If I run it in it''s own executable then when I click the X on the form or
click the close button I added, the form closes but the app is still running
in memory and is "orpahned".

I''ll look for the "background thread" problem suggested in the other reply
to my post.

Thanks

Edwin

"Lau Lei Cheong" <le****@yehoo.com.hkwrote in message
news:OP**************@TK2MSFTNGP04.phx.gbl...

Try call Application.Exit() instead.

If it works, check the line Application.Run() whether it is the form your
DataGridView is running on.

If not, run it in Debug mode. Try closing the application and click Pause
after the screen goes off to see where your code stuck at.

"Edwin Smith" <sm**********@aol.com>
???g?ó?l¥ó·s?D:uG**************@TK2MSFTNGP05.phx.g bl...

>>I have a form which displays a DataGridView table generated with the
VS2005 tools. The database is a Pervasive v.9 with an ODBC driver.

The DataGridView works great except when I''m done and I click the X to
close the form the .exe refuses to die and has to be killed in Task
manager.

I ran a debug trace and it seems to work fine. I dropped a CLOSE button
onto the form and put "this.Close();" in for it''s event but I get the
same result.

Using trial/error troubleshooting seems to point to some of the generated
code behind the TableAdapter. If I comment it out the form closes
properly but then of course my DataGridView doesn''t work.

Anyone have a similar problem?

I''m also having a VS2005 lockup problem (on another thread) which may or
may not be related.

My next step is to start over from scratch since it''s fairly easy to
rebuild once I have screenshots of my queries etc...

Edwin




这篇关于表格关闭时,流程不会消亡。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆