View Full Version : [SOLVED] C# - Event handler can't access parent function objects.

October 21st, 2009, 07:16 PM
As simple as that .. how do I make global objects ? Once you click on the list item, I need it to load appropriate description, but so far, seems impossible.

public void FetchData(string url)
XmlDocument xDoc = new XmlDocument();
XmlNodeList title = xDoc.GetElementsByTagName("title");
XmlNodeList description = xDoc.GetElementsByTagName("description");

for (int i = 0; i < title.Count; i++)

lstEntries.Click += new System.EventHandler(lstEntries_OnClick);

private void lstEntries_OnClick(object sender, System.EventArgs e)
// description array can't be accessed from here