Click here to Skip to main content
15,902,112 members
Home / Discussions / C#
   

C#

 
AnswerRe: Can i copy or extract files from a resource file? Pin
Anonymous19-May-05 23:15
Anonymous19-May-05 23:15 
Generalc# program to find the version& language Pin
ziczaczoom200418-May-05 10:37
ziczaczoom200418-May-05 10:37 
GeneralRe: c# program to find the version& language Pin
DavidNohejl18-May-05 10:49
DavidNohejl18-May-05 10:49 
GeneralRe: c# program to find the version& language Pin
ziczaczoom200418-May-05 10:54
ziczaczoom200418-May-05 10:54 
GeneralRe: c# program to find the version& language Pin
DavidNohejl18-May-05 11:01
DavidNohejl18-May-05 11:01 
GeneralRe: c# program to find the version& language Pin
DavidNohejl18-May-05 11:18
DavidNohejl18-May-05 11:18 
QuestionPropertyGrid: creating custom type converters and run-time attribute changes? Pin
Blazej Stompel18-May-05 9:29
Blazej Stompel18-May-05 9:29 
GeneralSimple XML problem Pin
Snowjim18-May-05 8:24
Snowjim18-May-05 8:24 
Hey!

I have the following XML containt
<br />
-<br />
<settings><br />
<Port>0</Port><br />
<StopBits>4</StopBits><br />
<Parity>2</Parity><br />
<BoudRate>9</BoudRate><br />
<DataBits>4</DataBits><br />
<AddTimeStamp>True</AddTimeStamp><br />
<SaveToFile>True</SaveToFile><br />
<SizeOfWindow>MEDIUM</SizeOfWindow><br />
<MountedDisplay>True</MountedDisplay><br />
</settings>


I am using this C# code to fetch it:

<br />
               xTR = new XmlTextReader("PortSettings.xml");<br />
                xTR.MoveToContent();<br />
<br />
                while (xTR.Read())<br />
                {<br />
                    if (xTR.NodeType == XmlNodeType.Element)<br />
                    {<br />
                        switch (xTR.Name)<br />
                        {<br />
                            case "Port":<br />
                                MessageBox.Show("Port : " + xTR.ReadElementString("Port"));<br />
                                break;<br />
                            case "StopBits":<br />
                                MessageBox.Show("StopBits : " + xTR.ReadElementString("StopBits"));<br />
                                break;<br />
                            case "Parity":<br />
                                MessageBox.Show("Parity : " + xTR.ReadElementString("Parity"));<br />
                                break;<br />
                            case "BoudRate":<br />
                                MessageBox.Show("BoudRate : " + xTR.ReadElementString("BoudRate"));<br />
                                break;<br />
                            case "DataBits":<br />
                                MessageBox.Show("DataBits : " + xTR.ReadElementString("DataBits"));<br />
                                break;<br />
                            case "AddTimeStamp":<br />
                                MessageBox.Show("AddTimeStamp : " + xTR.ReadElementString("AddTimeStamp"));<br />
                                break;<br />
                            case "SaveToFile":<br />
                                MessageBox.Show("SaveToFile : " + xTR.ReadElementString("SaveToFile"));<br />
                                break;<br />
                            case "SizeOfWindow":<br />
                                MessageBox.Show("SizeOfWindow : " + xTR.ReadElementString("SizeOfWindow"));<br />
                                break;<br />
                            case "MountedDisplay":<br />
                                MessageBox.Show("MountedDisplay : " + xTR.ReadElementString("MountedDisplay"));<br />
                                break;<br />
                            default:<br />
                                break;<br />
                        }<br />
                    }<br />
                }<br />
                xTR.Close();<br />


Problem: It only read Port, Parity, DataBits, SaveToFile and Monted Display. With other words its only reads every other.

Probley this is a simple mistake, pleas help.

Best Regards
SnowJim
GeneralRe: Simple XML problem Pin
Snowjim18-May-05 8:26
Snowjim18-May-05 8:26 
GeneralRe: Simple XML problem Pin
Snowjim18-May-05 11:37
Snowjim18-May-05 11:37 
GeneralRe: Simple XML problem Pin
Robert Rohde18-May-05 9:21
Robert Rohde18-May-05 9:21 
GeneralRe: Simple XML problem Pin
DavidNohejl18-May-05 10:22
DavidNohejl18-May-05 10:22 
GeneralRe: Simple XML problem Pin
Snowjim18-May-05 11:34
Snowjim18-May-05 11:34 
GeneralRe: Simple XML problem Pin
leppie18-May-05 9:40
leppie18-May-05 9:40 
GeneralRe: Simple XML problem Pin
DavidNohejl18-May-05 10:28
DavidNohejl18-May-05 10:28 
GeneralRe: Simple XML problem Pin
Snowjim18-May-05 11:26
Snowjim18-May-05 11:26 
GeneralRe: Simple XML problem Pin
DavidNohejl18-May-05 12:34
DavidNohejl18-May-05 12:34 
GeneralRe: Simple XML problem Pin
Snowjim18-May-05 12:44
Snowjim18-May-05 12:44 
GeneralRe: Simple XML problem Pin
DavidNohejl18-May-05 13:26
DavidNohejl18-May-05 13:26 
GeneralRe: Simple XML problem Pin
Snowjim18-May-05 13:31
Snowjim18-May-05 13:31 
GeneralReusing a local port when sending from a bound socket Pin
ghassett2218-May-05 7:28
ghassett2218-May-05 7:28 
QuestionC# 'static' variables on the web? Pin
LizardWiz18-May-05 7:05
LizardWiz18-May-05 7:05 
AnswerRe: C# 'static' variables on the web? Pin
S. Senthil Kumar18-May-05 7:24
S. Senthil Kumar18-May-05 7:24 
AnswerRe: C# 'static' variables on the web? Pin
S Sansanwal18-May-05 12:09
S Sansanwal18-May-05 12:09 
AnswerRe: C# 'static' variables on the web? Pin
Joshua Nussbaum18-May-05 14:21
Joshua Nussbaum18-May-05 14:21 

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.