4
Answers

Very EASY please !

Photo of crest dubua

crest dubua

17y
3.5k
1

I got this message on this LINE of CODE :

XmlTextReader XTR = new XmlTextReader("D:\\BOTOLA_MyDocument_Projects\\My Documents\\Visual Studio 2005\\Projects\\cs_XML_World\\WA_XML\\JO.xml");

while (XTR.Read);

Error 1 Cannot convert method group 'Read' to non-delegate type 'bool'. Did you intend to invoke the method?

Answers (4)

0
Photo of Ryan Alford
NA 1.7k 1.7m 17y
you need ( ) after Read since it is a method call.
0
Photo of crest dubua
NA 19 0 17y

Ok here is all of the code:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.Xml;

 

 

namespace cs_WA_XML

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}//form1

private void Form1_Load(object sender, EventArgs e)

{

 

 

 

if (this.B1.Text == Convert.ToString(55) | this.B1.Text == Convert.ToString(55))

B1.Text = Convert.ToString(17);

else

B1.Text = Convert.ToString(197);

 

}//load

private void B1_Click(object sender, EventArgs e)

{

 

int I;

string strNODE;

XmlTextReader XTR = new XmlTextReader("D:\\BOTOLA_MyDocument_Projects\\My Documents\\Visual Studio 2005\\Projects\\cs_XML_World\\WA_XML\\JO.xml");

 

 

 

do

{

if (Convert.ToBoolean(XTR.NodeType== XmlNodeType.Element || XTR.NodeType== XmlNodeType.Text))

 

for (I = 1; Convert.ToBoolean(XTR.Depth); I++)

{

strNODE = "";

strNODE = strNODE + XTR.Name + "";

strNODE += XTR.NodeType ;

}

if (XTR.HasValue)

strNODE = strNODE + ": " + XTR.Value;

 

LB1.Items.Add(strNODE);

}

 

 

while (XTR.Read);                          // ..............//Here is MISTAKE

}

 

} //class

} //namespace

 

HHHHHHHHHHHHHHHELP

0
Photo of crest dubua
NA 19 0 17y

I am about to finish and I only have these last 2 code glitches!

Really.

0
Photo of Ryan Alford
NA 1.7k 1.7m 17y
why don't you post all your questions in one post?  this is stupid to continue to create 6 posts about 2 problems.

and to answer your question, try:

while (XTR.Read())