Hi I’m having trouble multiplying data retrieved from google finance api. I know that what I’m doing now is wrong so I would like some pointers on how to go about doing that and some examples on that as well.
string url = "http://www.google.com/ig/api?stock=" + Server.UrlEncode(symbol1.Text);
XmlDocument xdoc = new XmlDocument();
xdoc.Load(url);
currentPrice1.Text = GetData(xdoc, "last");
int quantity = 50;
int currentPrice = int.Parse(currentPrice1.Text);
int totalValue = quantity * currentPrice;
GetData method
private string GetData(XmlDocument doc2, string strElement)
{
XmlNodeList xnodelist5 = doc2.GetElementsByTagName(strElement);
XmlNode xnode5 = xnodelist5.Item(0);
return Get_Attribute_Value(xnode5, "data");
}
ERROR

Might be value of data attribute is non-numeric or not specified. Use TryParse method or wrap up your code with try..catch.. block.
Or use
int.TryParseif value of data attribute is integer.