Win32Exception was unhandled

I added a tabbed control to a form and now I get this error... would anyone know why this is occurring... the following is a copy of the error...

System.ComponentModel.Win32Exception was unhandled
Message="Error creating window handle."
Source="System.Windows.Forms"
ErrorCode=-2147467259
NativeErrorCode=0
StackTrace:
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.RectangleToClient(Rectangle r)
at System.Windows.Forms.ScrollableControl.ScrollToControl(Control activeControl)
at System.Windows.Forms.ScrollableControl.ScrollControlIntoView(Control activeControl)
at System.Windows.Forms.ContainerControl.ScrollActiveControlIntoView()
at System.Windows.Forms.Form.AdjustFormScrollbars(Boolean displayScrollbars)
at System.Windows.Forms.ScrollableControl.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.Form.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)
at System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, String property)
at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)
at System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, String property)
at System.Windows.Forms.ToolStripItem.InvalidateItemLayout(String affectedProperty, Boolean invalidatePainting)
at System.Windows.Forms.ToolStripItem.OnTextChanged(EventArgs e)
at System.Windows.Forms.ToolStripControlHost.HandleTextChanged(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnTextChanged(EventArgs e)
at System.Windows.Forms.TextBoxBase.OnTextChanged(EventArgs e)
at System.Windows.Forms.Control.set_Text(String value)
at System.Windows.Forms.TextBoxBase.set_Text(String value)
at System.Windows.Forms.TextBox.set_Text(String value)
at System.Windows.Forms.ToolStripControlHost.set_Text(String value)
at System.Windows.Forms.BindingNavigator.RefreshItemsCore()
at System.Windows.Forms.BindingNavigator.OnRefreshItems()
at System.Windows.Forms.BindingNavigator.RefreshItemsInternal()
at System.Windows.Forms.BindingNavigator.WireUpBindingSource(BindingSource& oldBindingSource, BindingSource newBindingSource)
at System.Windows.Forms.BindingNavigator.Dispose(Boolean disposing)
at System.ComponentModel.Component.Dispose()
at System.ComponentModel.Container.Dispose(Boolean disposing)
at System.ComponentModel.Container.Dispose()
at WindowsApplication1.frmMillDetail.Dispose(Boolean disposing) in D:\VB Dot Net\MDI_Test\MDI_Test\MDI_Test\frmMillDetail.Designer.vb:line 9
at System.ComponentModel.Component.Dispose()
at System.Windows.Forms.Control.Dispose(Boolean disposing)
at System.ComponentModel.Component.Dispose()
at System.Windows.Forms.Control.Dispose(Boolean disposing)
at System.Windows.Forms.Form.Dispose(Boolean disposing)
at WindowsApplication1.frmMain.Dispose(Boolean disposing) in D:\VB Dot Net\MDI_Test\MDI_Test\MDI_Test\frmMain.Designer.vb:line 11
at System.ComponentModel.Component.Dispose()
at System.Windows.Forms.Form.WmClose(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DefFrameProc(IntPtr hWnd, IntPtr hWndClient, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.Form.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmSysCommand(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DefFrameProc(IntPtr hWnd, IntPtr hWndClient, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.Form.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmNcButtonDown(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.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(Int32 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 System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

[7246 byte] By [BrianShafer] at [2007-12-22]
# 1
Can you give us some code where the error is being thrown?
ahmedilyas at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2
Well, that is part of the problem, this is thrown when I close the application, and I don't see an indication of where it might be occurring.
BrianShafer at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 3

Hi Brian,

Did you get a response to this problem?

I'm seeing the same thing with an Interop application I am testing on Vista?

-Brad

Brad1234567 at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 4
Do you have any code handling the Close event or any other event that may fire during a close? If so can you post that?
JaredParsonsMSFT at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 5
I'll move this to the Windows Forms Forums. They might have a better idea of what's going on with the callstack.
MSFTAbelValadez at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 6

I gather your response answers my question to Brian!

FYI...

I've built a Interop add-in for Mindjet MindManager X5. I ported the code directly from my old XP machine and it failed immediately. I tracked it down to use of a TextBox in a form. My original application contains some forms but nothing too complicated. As a test I created a new form in the original add-in. It works find with just the ok/cancel button. As soon as you add any other control, i.e. TextBox, you get the exception error very much like what Brian describes above. I tried a new fresh Windows Application and couldn't repeat the problem. This leads me to believe the problem is related to X5 and Vista. I'm going to give up on Vista for now and get my add-in working with the new version of MindManager before I spend any more time on Vista.

Brad1234567 at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...