我表单上的所有按钮似乎都触发了某些东西-VB.Net [英] All Buttons on my form seem to be triggering something-VB.Net

查看:109
本文介绍了我表单上的所有按钮似乎都触发了某些东西-VB.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望我的问题有所帮助。



我有一个窗体,其中所有控件都是动态创建的。



但是,所有的按钮似乎都在它的.click事件之前触发Something,而Something导致我的组合框中的selectedindexchanged被触发。我已经彻底完成了事件处理程序的声明,并确保没有任何按钮将SIC作为事件进行修改。



我注意到点击的正常行为一个带鼠标的按钮,当按下按钮但按下并释放按钮外的区域时,按钮不会被触发。



有趣的是在我的情况下,即使在按下释放之前,点击本身也会触发Something。



任何人都能告诉我按钮发生了什么?



以下是我似乎并不理解的InteliTrace事件:



调用线程< ;没有名字=> (6976)

[System.Threading.ThreadHelper.ThreadStart()]

SESAdminForm.My.MyApplication.Main(String()Args = {String(0)})

[Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(string [] commandLine = {unknown})]

System.Windows.Forms.Application.Run(System.Windows) .Forms.ApplicationContext context = {unknown})

ThreadContext.RunMessageLoop(int reason = {unknown},System.Windows.Forms.ApplicationContext context = {unknown})

ThreadContext.RunMessageLoopInner(int reason = {unknown},System.Windows.Forms.ApplicationContext context = {unknown})

ThreadContext.RunMessageLoopInner(int reason = {unknown},System.Windows.Forms.ApplicationContext context = {unknown})

System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd = {unknown},int msg = {unknown},System.IntPtr wparam = {unknown},System .IntPtr lparam = {unknown})

ControlNativeWindow.WndProc(ref System.Window s.Forms.Message m = {unknown})

ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m = {unknown})

System.Windows.Forms .Button.WndProc(ref System.Windows.Forms.Message m = {unknown})

System.Windows.Forms.ButtonBase.WndProc(ref System.Windows.Forms.Message m = {unknown} )

System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m = {unknown})

System.Windows.Forms.Control.WmMouseDown (ref System.Windows.Forms.Message m = {unknown},System.Windows.Forms.MouseButtons button = {unknown},int clicks = {unknown})

System.Windows.Forms.Control .FocusInternal()

System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd = {unknown},int msg = {unknown},System.IntPtr wparam = {unknown},System.IntPtr lparam = {unknown})

ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m = {unknown})

ControlNativeWindow.OnMessage(ref System.Windows.Forms .Message m = {unkno wn})

System.Windows.Forms.Button.WndProc(ref System.Windows.Forms.Message m = {unknown})

System.Windows.Forms.ButtonBase .WndProc(ref System.Windows.Forms.Message m = {unknown})

System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m = {unknown})

System.Windows.Forms.Control.WmSetFocus(ref System.Windows.Forms.Message m = {unknown})

System.Windows.Forms.ContainerControl.ActivateControlInternal(System .Windows.Forms.Control control = {unknown})

System.Windows.Forms.ContainerControl.ActivateControlInternal(System.Windows.Forms.Control control = {unknown},bool originator = {unknown})

System.Windows.Forms.ContainerControl.AssignActiveControlInternal(System.Windows.Forms.Control value = {unknown})

System.Windows.Forms.ContainerControl.UpdateFocusedControl()

System.Windows.Forms.ContainerControl.EnterValidation(System.Windows.Forms.Control enterControl = {unknown})

Sys tem.Windows.Forms.ContainerControl.ValidateThroughAncestor(System.Windows.Forms.Control ancestorControl = {unknown},bool preventFocusChangeOnError = {unknown})

System.Windows.Forms.Control.PerformControlValidation(bool bulkValidation = {unknown})

System.Windows.Forms.Control.NotifyValidating()

System.Windows.Forms.ComboBox.OnValidating(System.ComponentModel.CancelEventArgs e = {未知})

System.Windows.Forms.ComboBox.NotifyAutoComplete()

System.Windows.Forms.ComboBox.NotifyAutoComplete(bool setSelectedIndex = {unknown})

设置System.Windows.Forms.ComboBox.SelectedIndex(int value = {unknown})

System.Windows.Forms.ComboBox.OnSelectedIndexChanged(System.EventArgs e = {unknown})

SESAdminForm.DataEntry.cBox_SelectionChangeCommittedUseItem2(Object sender = {System.Windows.Forms.ComboBox},System.EventArgs e = {System.EventArgs})

SESAdminForm.DataEntry。 DisplayText()



- >有2个与按钮相关的消息,但是在mousedown事件之前似乎有一个消息发生..



感谢您的时间。

Hope there can be some help to my problem.

I have a windows form in which all the controls are created dynamically.

However, all the buttons seem to be triggering "Something" before it's .click event, and the "Something" is causing the selectedindexchanged of my comboboxes to fire. I have thoroughly gone through the event handlers declared, and made sure that none of the buttons have SIC pathed as their events.

I have noticed that the normal behaviour for clicking a button with a mouse, is that when a button is clicked on but held down and released in an area outside of the button, the button is not triggered.

Interestingly in my case, the click itself triggers the "Something" even before the pressing is released.

Anyone would be able to advise what is going on with my buttons?

Here is the InteliTrace events which I don't really seem to understand:

Calls for thread <no name=""> (6976)
[System.Threading.ThreadHelper.ThreadStart()]
SESAdminForm.My.MyApplication.Main(String() Args = {String(0)})
[Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(string[] commandLine = {unknown})]
System.Windows.Forms.Application.Run(System.Windows.Forms.ApplicationContext context = {unknown})
ThreadContext.RunMessageLoop(int reason = {unknown}, System.Windows.Forms.ApplicationContext context = {unknown})
ThreadContext.RunMessageLoopInner(int reason = {unknown}, System.Windows.Forms.ApplicationContext context = {unknown})
ThreadContext.RunMessageLoopInner(int reason = {unknown}, System.Windows.Forms.ApplicationContext context = {unknown})
System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd = {unknown}, int msg = {unknown}, System.IntPtr wparam = {unknown}, System.IntPtr lparam = {unknown})
ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m = {unknown})
ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m = {unknown})
System.Windows.Forms.Button.WndProc(ref System.Windows.Forms.Message m = {unknown})
System.Windows.Forms.ButtonBase.WndProc(ref System.Windows.Forms.Message m = {unknown})
System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m = {unknown})
System.Windows.Forms.Control.WmMouseDown(ref System.Windows.Forms.Message m = {unknown}, System.Windows.Forms.MouseButtons button = {unknown}, int clicks = {unknown})
System.Windows.Forms.Control.FocusInternal()
System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd = {unknown}, int msg = {unknown}, System.IntPtr wparam = {unknown}, System.IntPtr lparam = {unknown})
ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m = {unknown})
ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m = {unknown})
System.Windows.Forms.Button.WndProc(ref System.Windows.Forms.Message m = {unknown})
System.Windows.Forms.ButtonBase.WndProc(ref System.Windows.Forms.Message m = {unknown})
System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m = {unknown})
System.Windows.Forms.Control.WmSetFocus(ref System.Windows.Forms.Message m = {unknown})
System.Windows.Forms.ContainerControl.ActivateControlInternal(System.Windows.Forms.Control control = {unknown})
System.Windows.Forms.ContainerControl.ActivateControlInternal(System.Windows.Forms.Control control = {unknown}, bool originator = {unknown})
System.Windows.Forms.ContainerControl.AssignActiveControlInternal(System.Windows.Forms.Control value = {unknown})
System.Windows.Forms.ContainerControl.UpdateFocusedControl()
System.Windows.Forms.ContainerControl.EnterValidation(System.Windows.Forms.Control enterControl = {unknown})
System.Windows.Forms.ContainerControl.ValidateThroughAncestor(System.Windows.Forms.Control ancestorControl = {unknown}, bool preventFocusChangeOnError = {unknown})
System.Windows.Forms.Control.PerformControlValidation(bool bulkValidation = {unknown})
System.Windows.Forms.Control.NotifyValidating()
System.Windows.Forms.ComboBox.OnValidating(System.ComponentModel.CancelEventArgs e = {unknown})
System.Windows.Forms.ComboBox.NotifyAutoComplete()
System.Windows.Forms.ComboBox.NotifyAutoComplete(bool setSelectedIndex = {unknown})
Set System.Windows.Forms.ComboBox.SelectedIndex(int value = {unknown})
System.Windows.Forms.ComboBox.OnSelectedIndexChanged(System.EventArgs e = {unknown})
SESAdminForm.DataEntry.cBox_SelectionChangeCommittedUseItem2(Object sender = {System.Windows.Forms.ComboBox}, System.EventArgs e = {System.EventArgs})
SESAdminForm.DataEntry.DisplayText()

-> There is 2 button-related messages but one seem to happen even before the mousedown event..

Thanks for your time.

推荐答案

查看MouseDown事件 - 看起来就像在按钮或表单本身中为它设置了一个处理程序。
Look at the MouseDown event -looks like you have a handler set for it either in the button, or the form itself.


这篇关于我表单上的所有按钮似乎都触发了某些东西-VB.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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