Click here to Skip to main content
15,900,455 members
Home / Discussions / C#
   

C#

 
AnswerRe: returning values Pin
Mircea Puiu9-Jan-07 0:36
Mircea Puiu9-Jan-07 0:36 
AnswerRe: returning values Pin
Colin Angus Mackay9-Jan-07 0:42
Colin Angus Mackay9-Jan-07 0:42 
AnswerRe: returning values Pin
M. A. Deniz Yalman9-Jan-07 0:45
M. A. Deniz Yalman9-Jan-07 0:45 
GeneralRe: returning values Pin
Colin Angus Mackay9-Jan-07 5:43
Colin Angus Mackay9-Jan-07 5:43 
AnswerRe: returning values Pin
ednrgc9-Jan-07 2:59
ednrgc9-Jan-07 2:59 
AnswerRe: returning values Pin
andyharman9-Jan-07 6:58
professionalandyharman9-Jan-07 6:58 
GeneralRe: returning values Pin
PandaBear113-Nov-09 16:29
PandaBear113-Nov-09 16:29 
Questionreading xml file to listbox Pin
Yustme9-Jan-07 0:13
Yustme9-Jan-07 0:13 
Hi,

I've got a problem with reading in an xml file into a listbox

This is the code:

XmlDocument xmlDoc = new XmlDocument();
XmlTextReader xtr = new XmlTextReader(path);
xtr.WhitespaceHandling = WhitespaceHandling.None;
xmlDoc.Load(path);

while (xtr.Read())
{
if (xtr.Name.Equals("test") && xtr.NodeType == XmlNodeType.Element)
{
this.listBox.Items.Add( xtr.ReadElementString("test").ToString());
}

Thread.Sleep(10);
}

This is the xml files content:

<?xml version="1.0" encoding="UTF-8"?>
<Testing>
<test>1111111</test>
<test>2222222</test>
<test>1111111</test>
<test>3333333</test>
<test>1111111</test>
</Testing>

The problem is, it skips the "222222" and "333333" by not adding them into the listbox.

The rest of the xml file does get loaded in the listbox.

So this is what i get:

1111111
1111111
1111111

In stead of:

1111111
2222222
1111111
3333333
1111111

Can somebody point to me what i am doing wrong?

Thanks in advance!
AnswerRe: reading xml file to listbox Pin
Colin Angus Mackay9-Jan-07 0:28
Colin Angus Mackay9-Jan-07 0:28 
GeneralRe: reading xml file to listbox Pin
Yustme9-Jan-07 0:45
Yustme9-Jan-07 0:45 
GeneralRe: reading xml file to listbox Pin
Colin Angus Mackay9-Jan-07 2:02
Colin Angus Mackay9-Jan-07 2:02 
AnswerRe: reading xml file to listbox Pin
Stefan Troschuetz9-Jan-07 0:29
Stefan Troschuetz9-Jan-07 0:29 
GeneralRe: reading xml file to listbox Pin
Yustme9-Jan-07 0:59
Yustme9-Jan-07 0:59 
GeneralRe: reading xml file to listbox Pin
Stefan Troschuetz9-Jan-07 1:06
Stefan Troschuetz9-Jan-07 1:06 
GeneralRe: reading xml file to listbox Pin
Yustme9-Jan-07 1:26
Yustme9-Jan-07 1:26 
QuestionHow to provide the Search option Pin
Vishalagrawal19-Jan-07 0:12
Vishalagrawal19-Jan-07 0:12 
AnswerRe: How to provide the Search option Pin
Pete O'Hanlon9-Jan-07 0:32
mvePete O'Hanlon9-Jan-07 0:32 
QuestionByteArray To Image Pin
AB77718-Jan-07 22:57
AB77718-Jan-07 22:57 
AnswerRe: ByteArray To Image Pin
Christian Graus8-Jan-07 23:13
protectorChristian Graus8-Jan-07 23:13 
GeneralRe: ByteArray To Image Pin
AB77718-Jan-07 23:21
AB77718-Jan-07 23:21 
GeneralRe: ByteArray To Image Pin
Christian Graus8-Jan-07 23:30
protectorChristian Graus8-Jan-07 23:30 
AnswerRe: ByteArray To Image Pin
J. Dunlap8-Jan-07 23:15
J. Dunlap8-Jan-07 23:15 
GeneralRe: ByteArray To Image Pin
AB77719-Jan-07 0:39
AB77719-Jan-07 0:39 
QuestionFormatting DateTime Pin
GermanDM8-Jan-07 22:47
GermanDM8-Jan-07 22:47 
AnswerRe: Formatting DateTime Pin
Christian Graus8-Jan-07 23:18
protectorChristian Graus8-Jan-07 23:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.