D
Doug
Hi
i have a method that returns a value
public bool readxml (string xmlFilename, out string value)
but I would like to catch an exception if it occurs in the method .
How do i catch the following error if the xmlField 'location' doesn't exist
in the xmlfile or if the xmlfile is blank?
public bool readxml(string xmlFilename, out string value)
{
XmlTextReader tr = new XmlTextReader(xmlFilename);
{
if (tr.ReadToFollowing("location"))
{
value = tr.ReadString();
tr.Close();
return true;
}
else
{
value = null;
tr.Close();
return false;
}
}
Many thanks,
Doug
i have a method that returns a value
public bool readxml (string xmlFilename, out string value)
but I would like to catch an exception if it occurs in the method .
How do i catch the following error if the xmlField 'location' doesn't exist
in the xmlfile or if the xmlfile is blank?
public bool readxml(string xmlFilename, out string value)
{
XmlTextReader tr = new XmlTextReader(xmlFilename);
{
if (tr.ReadToFollowing("location"))
{
value = tr.ReadString();
tr.Close();
return true;
}
else
{
value = null;
tr.Close();
return false;
}
}
Many thanks,
Doug