我如何从后退跟踪中停止事件 [英] how I stop Event from back tracking

查看:69
本文介绍了我如何从后退跟踪中停止事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







借助远程处理我创建了客户端和服务器两个应用程序。从客户端应用程序我处理服务器

边会事件。但问题是我调用event.Event

后退跟踪正在进行中。服务器应用程序从

sub main开始。在我从客户端调用事件后,应用evnet返回

跟踪正在进行并且事件开始返回并返回到

sub main。和形式错误的形式。显示。



你能不能告诉我应该如何停止事件追溯



谢谢

Hi,


with the help of remoting I created client and server two applciation. From client application I am handling server
side events. but problem is that after I invoke event.Event
back tracking is going on. server application is opening from
sub main. After I call event from client applicaiton evnet back
tracking is going on and event start going back and back up to
sub main. and ging error of form.show.

Could you please suuges how should I stop event back tracking

Thanks

推荐答案

事件不是单向的,如果您正在调试和跟踪事件,事件会调用一个函数(接收者)以及完成调用的时间堆栈必须折叠回到事件触发例程。



我认为你的问题是,你是在不同的线程上在UI上进行交互(事件是产生的)在新线程中)。与事件中的表单交互将导致异常(事件被触发,而不是与UI交互的位置)。



为了与UI交互,如果表单上的InvokeRequired标志为true,则必须调用(使用Form.Invoke或Control.Invoke)方法控制。即使在打开新表单或设置现有控件或表单的属性时也是如此,否则可能会出现IllegalCrossThreadException或应用程序挂起。
Events are not one way, if you are debugging and tracing your events, the event calls a function (the receiver) and when it is finished the call stack MUST collapse back up to the event firing routine.

What I think your problem is, is that you are interacting on the UI from a different thread (events are spawned in new threads). Interacting with a form from an event will cause an exception (where the event is fired, not where you interact with the UI).

In order to interact with the UI, you have to invoke (using the Form.Invoke or Control.Invoke) methods if the InvokeRequired flag is true on the form or control. This is true even when opening new forms or setting properties of existing controls or forms, otherwise you can get an IllegalCrossThreadException or an application hang.


这篇关于我如何从后退跟踪中停止事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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