hi...
i'm getting a null reference exception unhandled error.....
i have inserted the code snippet and a screenshot...
please tell me where i'm going wrong.....
DataSources[] dataSources;
int i = 0;
_list = doc.GetElementsByTagName("DataSource");
foreach (XmlNode tempNode in _list)
{
//MessageBox.Show(tempNode.Attributes["Name"].Value.ToString());
//MessageBox.Show(tempNode.InnerXml.ToString());
dataSources[i]=new DataSources();
dataSources[i].getContent(tempNode);
i++;
}
the class file for datasources...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Windows.Forms;
namespace SSRS_Companion
{
class DataSources
{
public string name;
public string ID;
public string reference;
public void getContent(XmlNode node)
{
try
{
//MessageBox.Show(node.InnerXml.ToString());
this.name = new string(node.Attributes["Name"].Value.ToCharArray());
this.ID = new string(node.ChildNodes[0].Value.ToCharArray());
this.reference = new string( node.ChildNodes[1].Value.ToCharArray());
}
catch (Exception e)
{
MessageBox.Show(e.ToString(), "Data Sources");
}
}
}
}
and the screenshot