code:
static public void NextQuestion(string expression)
{
XPathDocument doc = new XPathDocument(xmlFilePath);
XPathNavigator nav = doc.CreateNavigator();
XPathExpression expr;
expr = nav.Compile(expression);
XPathNodeIterator iterator = nav.Select(expr);
iterator.MoveNext();
XPathNavigator nav2 = iterator.Current.Clone();
nav2.MoveToFirstChild();
question = nav2.Value;
}
code for button that calls the method:
private void button5_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
quizmaster.Program.NextQuestion("/questionBase/question/questionBody"); //what nodes to find in the xml structure
listBox1.Items.Add(quizmaster.Program.question); //add the variable question to the listBox
}
thanks
ryan