T
Tom P.
I'm getting the following error when I open a form that holds several
userControls. I'm hiding and showing the usercontrols as the user
navigates a treeview of preferences. But if I create the preferences
window more than twice I get he exception below. It happens when the
form tries to instantiate a control but it's designer-generated code
so I had nothing to do with it.
I call Dispose() on all the usercontrols, I call dispose on the
preferences form... I set any old member variables to null... I can't
think of anything else.
Any help would be appreciated, I can't figure this one out.
Tom P.
System.ArgumentException was unhandled
Message="Parameter is not valid."
Source="System.Drawing"
StackTrace:
at System.Drawing.Font.GetHeight(Graphics graphics)
at System.Drawing.Font.GetHeight()
at System.Drawing.Font.get_Height()
at System.Windows.Forms.Control.get_FontHeight()
at System.Windows.Forms.ComboBox.get_PreferredHeight()
at System.Windows.Forms.ComboBox.get_DefaultSize()
at System.Windows.Forms.Control..ctor(Boolean
autoInstallSyncContext)
at System.Windows.Forms.ListControl..ctor()
at System.Windows.Forms.ComboBox..ctor()
at FileTracker.userControlGeneral.InitializeComponent() in C:\
$hank\Projects\FileTracker\FileTracker\UserControls
\userControlGeneral.designer.cs:line 32
at FileTracker.userControlGeneral..ctor() in C:\$hank\Projects
\FileTracker\FileTracker\UserControls\userControlGeneral.cs:line 18
at FileTracker.FormPreferences.FormPreferences_Load(Object
sender, EventArgs e) in C:\$hank\Projects\FileTracker\FileTracker\Forms
\FormPreferences.cs:line 67
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean
fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(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.WmShowWindow(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.SafeNativeMethods.ShowWindow(HandleRef
hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
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.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at FileTracker.formMain.toolStripMenuItemPreferences_Click
(Object sender, EventArgs e) in C:\$hank\Projects\FileTracker
\FileTracker\FormMain.cs:line 1111
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key,
EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp
(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive
(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e,
ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp
(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m,
MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.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(Form mainForm)
at FileTracker.FileTrackerMain.Main() in C:\$hank\Projects
\FileTracker\FileTracker\Program.cs:line 22
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()
InnerException:
userControls. I'm hiding and showing the usercontrols as the user
navigates a treeview of preferences. But if I create the preferences
window more than twice I get he exception below. It happens when the
form tries to instantiate a control but it's designer-generated code
so I had nothing to do with it.
I call Dispose() on all the usercontrols, I call dispose on the
preferences form... I set any old member variables to null... I can't
think of anything else.
Any help would be appreciated, I can't figure this one out.
Tom P.
System.ArgumentException was unhandled
Message="Parameter is not valid."
Source="System.Drawing"
StackTrace:
at System.Drawing.Font.GetHeight(Graphics graphics)
at System.Drawing.Font.GetHeight()
at System.Drawing.Font.get_Height()
at System.Windows.Forms.Control.get_FontHeight()
at System.Windows.Forms.ComboBox.get_PreferredHeight()
at System.Windows.Forms.ComboBox.get_DefaultSize()
at System.Windows.Forms.Control..ctor(Boolean
autoInstallSyncContext)
at System.Windows.Forms.ListControl..ctor()
at System.Windows.Forms.ComboBox..ctor()
at FileTracker.userControlGeneral.InitializeComponent() in C:\
$hank\Projects\FileTracker\FileTracker\UserControls
\userControlGeneral.designer.cs:line 32
at FileTracker.userControlGeneral..ctor() in C:\$hank\Projects
\FileTracker\FileTracker\UserControls\userControlGeneral.cs:line 18
at FileTracker.FormPreferences.FormPreferences_Load(Object
sender, EventArgs e) in C:\$hank\Projects\FileTracker\FileTracker\Forms
\FormPreferences.cs:line 67
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean
fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(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.WmShowWindow(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.SafeNativeMethods.ShowWindow(HandleRef
hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
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.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at FileTracker.formMain.toolStripMenuItemPreferences_Click
(Object sender, EventArgs e) in C:\$hank\Projects\FileTracker
\FileTracker\FormMain.cs:line 1111
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key,
EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp
(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive
(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e,
ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp
(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m,
MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.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(Form mainForm)
at FileTracker.FileTrackerMain.Main() in C:\$hank\Projects
\FileTracker\FileTracker\Program.cs:line 22
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()
InnerException: