I have just one HyperLinkEdit column, I have just one event and I'm testing to see if I can close the form on the event
I have this.Close() only in the MouseDown event. Why the app is crashing ?
I need to close the form on the MouseDown event of the GridView
DevExpress Version 12.1.8
Windows 8 Pro
Visual Studio 2012
.NET Framework 4.5
at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcHitInfo(Point pt)
at DevExpress.XtraGrid.Views.Grid.Handler.GridHandler.OnMouseDown(MouseEventArgs ev)
at DevExpress.Utils.Controls.BaseHandler.ProcessEvent(EventType etype, Object args)
at DevExpress.XtraGrid.GridControl.OnMouseDown(MouseEventArgs ev)
at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at DevExpress.XtraEditors.Container.EditorContainer.WndProc(Message& m)
at DevExpress.XtraGrid.GridControl.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at AccesManager.Program.Main() in c:\AccessManager\Program.cs:line 21
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hi,
Thank you for contacting us.
It is incorrect to call the Form.Close method immediately in the GridView.MouseDown event handler. When you call this method, all child controls of this form are being disposed of. But at this moment not all GridView processes have been finished.
I suggest you call the Form.Close method with some delay in the BeginInvoke method. Look at the following code:
private void gridView1_MouseDown(object sender, MouseEventArgs e) { //.... BeginInvoke(new MethodInvoker(delegate { this.Close(); })); }
I believe it should help you.