I have a program that is saving information into and XML file that is later read from to continue the users progress. I am having trouble getting the reader to work without an error
This is the code that I am having trouble with and below is the error. Thanks for the help!
Expand|Select|Wrap|Line Numbers
- Dim xmldoc As XmlDataDocument = New XmlDataDocument
- xmldoc.Load("please.xml")
- TextBox1.Text = xmldoc.SelectSingleNode("form1/text").InnerText
- TextBox1.BackColor = System.Drawing.ColorTranslator.FromHtml(xmldoc.SelectSingleNode("form1/color").InnerText)
- TextBox2.Text = xmldoc.SelectSingleNode("form1/text").InnerText
- TextBox2.BackColor = System.Drawing.ColorTranslator.FromHtml(xmldoc.SelectSingleNode("form1/color").InnerText)
System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
Source="WindowsApplication2"
StackTrace:
at WindowsApplication2.Form1.Button2_Click(Object sender, EventArgs e) in d:\Users\steinmetze\Documents\Visual Studio 2008\Projects\WindowsApplication2\WindowsApplicati on2\Form1.vb:line 100
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(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.Run MessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationCo ntext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.Run(String[] commandLine)
at WindowsApplication2.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.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: