View Single Post
 
Old 10-23-2017, 01:01 AM
SwsCheez SwsCheez is offline
Newcomer
 
Join Date: Oct 2012
Posts: 13
Default Don't know what is wrong

Please help! for some reason. I have used similar code to this to read an XML into textbox's but its not working now. Can someone please take a loo

Here is the XML File:

<?xml version="1.0" standalone="true"?>

-<DataSet1 xmlns="http://tempuri.org/DataSet1.xsd">


-<dtReminders>

<UserID>16</UserID>

<Date>10/14/2017</Date>

<Time>10:40 PM</Time>

<Prospect>Business 1</Prospect>

<Email>ken@gmail.com</Email>

<Reminder>Test 2</Reminder>

</dtReminders>


-<dtReminders>

<UserID>20</UserID>

<Date>10/16/2017</Date>

<Time>2:00 PM</Time>

<Prospect>Business 1</Prospect>

<Email>ken@gsnail.com</Email>

<Reminder>cvzv</Reminder>

</dtReminders>

</DataSet1>



Imports System.Xml
Imports System.Xml.XmlWriter
Imports System.Xml.XmlReader
Imports System.IO

Dim spath As String = Directory.GetCurrentDirectory
TextBox15.Text = spath

Dim xmlDoc2 As New XmlDocument()
xmlDoc2.Load(TextBox15.Text & "\Xmluserdata.xml")
Dim emnodes As XmlNodeList = xmlDoc2.DocumentElement.SelectNodes("/DataSet1")

TextBox9.Text = _ xmlDoc2.SelectSingleNode("DataSet1/dtReminders/UserID").InnerText
TextBox10.Text = _ xmlDoc2.SelectSingleNode("DataSet1/dtReminders/Date").InnerText


Here is the error: System.NullReferenceException occurred
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Sales Status
StackTrace:
at Sales_Status.Form7.Form7_Load(Object sender, EventArgs e) in C:\Users\kendi\documents\visual studio 2017\Projects\Sales Status\Sales Status\Form7.vb:line 50
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.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)


Any help would be greatly appreciated
__________________
I'll procrastinate tomorrow
Reply With Quote