|
-
Jul 12th, 2007, 02:33 AM
#1
Thread Starter
Addicted Member
[2005] TreeView Error??
I am trying to put a new treeview object into a menu that i downloaded from the internet. The menu is simply an outlook xp style one and you put a treeview in (like there inbox, outbox folders are) by:
NavigateBar1.RelatedControl.Controls.Add(VARIABLEHERE)
Below are the details of the error:
System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
Source="PrepTrak"
StackTrace:
at PrepTrak.frmContainer.NavigateBarButton7_OnNavigateBarButtonSelected(NavigateBarButtonEventArgs e) in C:\Documents and Settings\ross\Desktop\Projects\PrepTrak\PrepTrak\frmContainer.vb:line 342
at MT.WindowsUI.NavigationPane.NavigateBarButton.OnNavigateBarButtonSelectedEventHandler.Invoke(Navigat eBarButtonEventArgs e)
at MT.WindowsUI.NavigationPane.NavigateBarButton.PerformClick()
at MT.WindowsUI.NavigationPane.NavigateBarButton.OnMouseClick(MouseEventArgs e)
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.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.UserControl.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.IMsoCompo nentManager.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 PrepTrak.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
My Code is:
Code:
Dim f As New TreeView
f.BeginUpdate()
f.Nodes.Add("Parent")
f.Nodes(0).Nodes.Add("Child 1")
f.Nodes(0).Nodes.Add("Child 2")
f.Nodes(0).Nodes(1).Nodes.Add("Grandchild")
f.Nodes(0).Nodes(1).Nodes(0).Nodes.Add("Great Grandchild")
f.EndUpdate()
NavigateBar1.RelatedControl.Controls.Add(f)
Any ideas on what the problem is??
Cheers,
Ross
-
Jul 12th, 2007, 02:51 AM
#2
Re: [2005] TreeView Error??
Either NavigateBar1 or, more likely, its RelatedControl property are Nothing.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|