Application.Exit()不存在应用程序。 [英] Application.Exit() did not exist the application.

查看:84
本文介绍了Application.Exit()不存在应用程序。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在循环中使用System.Windows.Forms.Application.DoEvents()来处理用户

点击关闭按钮。


Private Sub btnclose_Click(ByVal sender As System.Object,ByVal e As

System.EventArgs)处理btnclose.Click

Me.Close()< br $>
System.Windows.Forms.Application.Exit

End Sub


但是,当用户点击关闭时,应用程序继续运行,以为

表格确实关闭了。


有什么我错过的吗?


谢谢。

解决方案

啊,好的逻辑错误。

Me.Close()做了它应该做的事情。关闭表单并停止执行

表格以及它的资源。

Application.Exit命令从未被处理过。

你可以删除Me.Close()。

如果你想让表格消失但继续运行,你可以试试

Me.Hide()。

然后应该执行Application.Exit命令。

虽然你的代码仍在运行,但这可能不是最优雅的方式

或适当的退出地点。


Gerald


"谢尔比" < SH **** @ itsupport.com.sg>在消息中写道

news:uy ************** @ TK2MSFTNGP09.phx.gbl ...

我在循环中使用System.Windows.Forms.Application.DoEvents()来处理用户单击关闭按钮。

私有子btnclose_Click(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理btnclose.Click
Me.Close()
System.Windows.Forms.Application.Exit
End Sub

然而,当用户点击关闭时,应用程序继续运行,认为
表单已关闭。

有什么我错过的吗?

谢谢。





我已更改为

Private Sub btnclose_Click(ByVal sender As System.Object ,ByVal e As

System.EventArgs)处理btnclose.Click

System.Windows.Forms.Application.Exit

End Sub


应用程序仍在运行,表格也关闭,没有

me.close()st atement。


" Cablewizard" <钙********* @ Yahoo.com>在留言中写道

新闻:Os **************** @ TK2MSFTNGP12.phx.gbl ...

啊,好ol逻辑错误。
Me.Close()做了它应该做的事情。关闭表单并停止
执行表单及其资源。
Application.Exit命令永远不会被处理。
你可以删除Me.Close()。<如果你想让表格消失但继续运行,你可以试试
Me.Hide()。
然后应该执行Application.Exit命令。
虽然如果你的代码仍在运行,这可能不是最优惠的b $ b优雅方式或适当的退出方式。

Gerald

谢尔比 < SH **** @ itsupport.com.sg>在消息中写道
新闻:uy ************** @ TK2MSFTNGP09.phx.gbl ...


我用过System .Windows.Forms.Application.DoEvents()在循环中处理
用户单击关闭按钮。

私有子btnclose_Click(ByVal发送者为System.Object,ByVal e As
System.EventArgs)处理btnclose.Click
Me.Close()
System.Windows.Forms.Application.Exit
End Sub

然而,应用程序继续当用户点击关闭时运行,认为
表格确实关闭了。

我有什么遗漏吗?

谢谢。




只需将一个简单的End放在Sub

Private Sub btnclose_Click(ByVal sender As System) .Object,ByVal e As
System.EventArgs)处理btnclose.Click


结束

结束Sub


这应该这样做。


Manny

" Shelby" < SH **** @ itsupport.com.sg>在消息中写道

news:uy ************** @ TK2MSFTNGP09.phx.gbl ...
我用过System.Windows.Forms .Application.DoEvents()在循环中处理
用户单击关闭按钮。

私有子btnclose_Click(ByVal发送者为System.Object,ByVal e As
System.EventArgs)处理btnclose.Click
Me.Close()
System.Windows.Forms.Application.Exit
End Sub

然而,当用户点击时应用程序继续运行关闭,以为
表格确实关闭了。

有什么我错过的吗?

谢谢。



Hi,
I used System.Windows.Forms.Application.DoEvents() in a loop to handle user
click close button .

Private Sub btnclose_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnclose.Click
Me.Close()
System.Windows.Forms.Application.Exit
End Sub

However, the application continues to run when user click close, thought the
form did close.

Is there anything I miss out?

Thanks.

解决方案

ah, good ol logic error.
Me.Close() did what it was supposed to. Closed the form and stopped execution
of the form along with it''s resources.
The Application.Exit command never got processed.
You could just remove the Me.Close().
If you want to make the form go away but continue to run, you might try
Me.Hide().
Then the Application.Exit command should execute.
Although if your code was still running, this might not be the most graceful way
or appropriate place to exit.

Gerald

"Shelby" <sh****@itsupport.com.sg> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl...

Hi,
I used System.Windows.Forms.Application.DoEvents() in a loop to handle user
click close button .

Private Sub btnclose_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnclose.Click
Me.Close()
System.Windows.Forms.Application.Exit
End Sub

However, the application continues to run when user click close, thought the
form did close.

Is there anything I miss out?

Thanks.



Hi,
I have change to
Private Sub btnclose_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnclose.Click
System.Windows.Forms.Application.Exit
End Sub

The application is still running and the form also close without the
me.close() statement.

"Cablewizard" <Ca*********@Yahoo.com> wrote in message
news:Os****************@TK2MSFTNGP12.phx.gbl...

ah, good ol logic error.
Me.Close() did what it was supposed to. Closed the form and stopped execution of the form along with it''s resources.
The Application.Exit command never got processed.
You could just remove the Me.Close().
If you want to make the form go away but continue to run, you might try
Me.Hide().
Then the Application.Exit command should execute.
Although if your code was still running, this might not be the most graceful way or appropriate place to exit.

Gerald

"Shelby" <sh****@itsupport.com.sg> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl...

Hi,
I used System.Windows.Forms.Application.DoEvents() in a loop to handle user click close button .

Private Sub btnclose_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnclose.Click
Me.Close()
System.Windows.Forms.Application.Exit
End Sub

However, the application continues to run when user click close, thought the form did close.

Is there anything I miss out?

Thanks.




Just put a simple End in the Sub

Private Sub btnclose_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnclose.Click
End
End Sub
This Should do it.

Manny
"Shelby" <sh****@itsupport.com.sg> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl... Hi,
I used System.Windows.Forms.Application.DoEvents() in a loop to handle user click close button .

Private Sub btnclose_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnclose.Click
Me.Close()
System.Windows.Forms.Application.Exit
End Sub

However, the application continues to run when user click close, thought the form did close.

Is there anything I miss out?

Thanks.



这篇关于Application.Exit()不存在应用程序。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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