winforms - VB.NET events handling in deep -


anybody know how events works in vb.net doubt happen if event code doesn't finish of handle event , new 1 happen.

i.e.: have doubleclick event , user make repeatedly , insistently double click lot of times fast.

the event code calls sub routines , functions in same form(not multi threading)

the event code restart form top or wait until finish , re enter when code executed?

today catch following 2 errors

error 1:

error al crear identificador de ventana. en system.windows.forms.nativewindow.createhandle(createparams cp) en system.windows.forms.control.createhandle() en system.windows.forms.control.createcontrol(boolean fignorevisible) en system.windows.forms.control.createcontrol() en system.windows.forms.control.controlcollection.add(control value) en system.windows.forms.tabcontrol.controlcollection.add(control value) en system.windows.forms.tabcontrol.tabpagecollection.insert(int32 index, tabpage tabpage) en commands.form1.datagridviewalarms_cellmousedoubleclick(object sender, datagridviewcellmouseeventargs e) 

error 2:

error al crear identificador de ventana. en system.windows.forms.nativewindow.createhandle(createparams cp) en system.windows.forms.control.createhandle() en system.windows.forms.control.get_handle() en system.windows.forms.control.creategraphicsinternal() en system.windows.forms.threadexceptiondialog..ctor(exception t) en system.windows.forms.application.threadcontext.onthreadexception(exception t) en system.windows.forms.control.wndprocexception(exception e) en system.windows.forms.control.controlnativewindow.onthreadexception(exception e) en system.windows.forms.nativewindow.callback(intptr hwnd, int32 msg, intptr wparam, intptr lparam) en system.windows.forms.unsafenativemethods.intcreatewindowex(int32 dwexstyle, string lpszclassname, string lpszwindowname, int32 style, int32 x, int32 y, int32 width, int32 height, handleref hwndparent, handleref hmenu, handleref hinst, object pvparam) en system.windows.forms.unsafenativemethods.createwindowex(int32 dwexstyle, string lpszclassname, string lpszwindowname, int32 style, int32 x, int32 y, int32 width, int32 height, handleref hwndparent, handleref hmenu, handleref hinst, object pvparam) en system.windows.forms.nativewindow.createhandle(createparams cp) en system.windows.forms.control.createhandle() en system.windows.forms.tabcontrol.createhandle() en system.windows.forms.control.createcontrol(boolean fignorevisible) en system.windows.forms.control.createcontrol(boolean fignorevisible) en system.windows.forms.control.createcontrol(boolean fignorevisible) en system.windows.forms.control.createcontrol() en system.windows.forms.control.controlcollection.add(control value) en system.windows.forms.tabcontrol.controlcollection.add(control value) en system.windows.forms.tabcontrol.tabpagecollection.insert(int32 index, tabpage tabpage) en commands.form1.datagridviewalarms_cellmousedoubleclick(object sender, datagridviewcellmouseeventargs e) 

this errors doesn't happen have 20 machines same program , 1 user have problems , happen when double click repeatedly fast.


i'm removing tappages following code

dim currenttab tabpage = alarmstabcontrol.selectedtab alarmstabcontrol.tabpages.remove(currenttab) 

the winform framework single-threaded. such, events processed on single-thread. therefore, when event handler called, no other event handlers called until first 1 has completed. in other words, event handlers called in serial fashion.

the way event handler can interrupted event if actively relinquishes control calling application.doevents. can imagine, calling doevents can cause unexpected behavior. since calling doevents typically leads bugs, discouraged , panned sign of poor design. in such cases, sign using backgroundworker more appropriate.

a little deeper

ui-related events triggered when window messages received operating system. incoming window messages added queue. responsibility of each process read window messages queue , handle them appropriately. typically done in message loop processes each message in queue in order, or idles until new message received. each time message loop finds new message processed, calls window procedure. window procedure typically called windowproc or wndproc. in .net winform projects, message loop initiated calling application.run.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -