Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Accessviolationexception vb.NET framework 3.5_Vb.net_Access Violation - Fatal编程技术网

Accessviolationexception vb.NET framework 3.5

Accessviolationexception vb.NET framework 3.5,vb.net,access-violation,Vb.net,Access Violation,当代码试图调用一个简单Windows窗体的MyBase.ShowDialog()时,我遇到了一个AccessViolationException“试图读取或写入受保护内存…” 这是一个使用visual studio 2008用vb.NET framework 3.5编写的Windows窗体应用程序 我在网上查过了,但什么也没找到 stackTrace说: en System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndPr

当代码试图调用一个简单Windows窗体的
MyBase.ShowDialog()
时,我遇到了一个
AccessViolationException
“试图读取或写入受保护内存…”

这是一个使用visual studio 2008用vb.NET framework 3.5编写的Windows窗体应用程序

我在网上查过了,但什么也没找到

stackTrace说:

en System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
en System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
en System.Windows.Forms.ToolTip.WndProc(Message& msg)
en System.Windows.Forms.ToolTip.ToolTipNativeWindow.WndProc(Message& m)
en System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
en System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
en System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
en System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.RunDialog(Form form)
en System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
en System.Windows.Forms.Form.ShowDialog()
关键是它并不是一直都在发生,表单声明如下:

<CLSCompliant(True)> Public Class FMensaje
    Inherits System.Windows.Forms.Form

如果有任何帮助,我们将不胜感激。

新的示例项目是否也会出现这种情况?一些有限的代码复制它可能是任何人都能提供帮助的唯一方式。嗨,Deanna,我更新了我的问题,提供了更多信息,感谢您回答
MyBase.ShowDialog();Me.BringToFront()
无论如何都会很奇怪,因为
ShowDialog()
是模态的,表单将关闭,然后您tru并将(卸载/不可见)表单带到前面
MyBase
Me
将实际上是同一个对象,除非您覆盖其中一个对象。我已更改MyBase.ShowDialog();对于Me.ShowDialog()并删除了Me.BringToFront(),但异常仍然引发:(
Public Overloads Function Show(ByVal strMensaje As String, ByVal enmTMensaje As en_TipoMensaje) As MsgBoxResult
    Try
        lblAviso.Text = strMensaje
        ...
        MyBase.ShowDialog()
        Me.BringToFront()
        Application.DoEvents()
        Show = m_mbrResultado
    Catch ex As Exception

    End Try
End Function