Click here to Skip to main content
15,921,840 members
Home / Discussions / C#
   

C#

 
AnswerRe: Download multiple files? Pin
Mark Swaanenburg12-Sep-07 2:23
Mark Swaanenburg12-Sep-07 2:23 
AnswerRe: Download multiple files? Pin
Scott Dorman12-Sep-07 8:18
professionalScott Dorman12-Sep-07 8:18 
QuestionRe: Download multiple files? Pin
bug_aonz12-Sep-07 17:11
bug_aonz12-Sep-07 17:11 
AnswerRe: Download multiple files? Pin
Scott Dorman13-Sep-07 4:16
professionalScott Dorman13-Sep-07 4:16 
GeneralRe: Download multiple files? Pin
bug_aonz13-Sep-07 16:56
bug_aonz13-Sep-07 16:56 
QuestionHow to check in form2 if a button on form1 has been clicked Pin
Lucy12-Sep-07 0:20
Lucy12-Sep-07 0:20 
AnswerRe: How to check in form2 if a button on form1 has been clicked Pin
blackjack215012-Sep-07 0:33
blackjack215012-Sep-07 0:33 
GeneralRe: How to check in form2 if a button on form1 has been clicked Pin
Lucy12-Sep-07 0:54
Lucy12-Sep-07 0:54 
AnswerRe: How to check in form2 if a button on form1 has been clicked Pin
Malcolm Smart12-Sep-07 1:00
Malcolm Smart12-Sep-07 1:00 
AnswerRe: How to check in form2 if a button on form1 has been clicked Pin
Xmen Real 12-Sep-07 1:24
professional Xmen Real 12-Sep-07 1:24 
GeneralRe: How to check in form2 if a button on form1 has been clicked Pin
Lucy12-Sep-07 1:29
Lucy12-Sep-07 1:29 
GeneralRe: How to check in form2 if a button on form1 has been clicked Pin
Xmen Real 12-Sep-07 1:31
professional Xmen Real 12-Sep-07 1:31 
GeneralRe: How to check in form2 if a button on form1 has been clicked Pin
Lucy12-Sep-07 1:32
Lucy12-Sep-07 1:32 
GeneralRe: How to check in form2 if a button on form1 has been clicked Pin
Xmen Real 12-Sep-07 1:35
professional Xmen Real 12-Sep-07 1:35 
GeneralRe: How to check in form2 if a button on form1 has been clicked Pin
Pete O'Hanlon12-Sep-07 1:49
mvePete O'Hanlon12-Sep-07 1:49 
AnswerRe: How to check in form2 if a button on form1 has been clicked Pin
Anthony Mushrow12-Sep-07 2:02
professionalAnthony Mushrow12-Sep-07 2:02 
AnswerRe: How to check in form2 if a button on form1 has been clicked Pin
Paras Kaneriya12-Sep-07 22:32
Paras Kaneriya12-Sep-07 22:32 
Question[Message Deleted] Pin
P_Elza12-Sep-07 0:12
P_Elza12-Sep-07 0:12 
AnswerRe: Go to a particular node. Pin
Mark Churchill12-Sep-07 0:14
Mark Churchill12-Sep-07 0:14 
GeneralRe: Go to a particular node. Pin
P_Elza12-Sep-07 0:56
P_Elza12-Sep-07 0:56 
AnswerRe: Go to a particular node. Pin
Xmen Real 12-Sep-07 1:29
professional Xmen Real 12-Sep-07 1:29 
GeneralRe: Go to a particular node. Pin
P_Elza12-Sep-07 2:12
P_Elza12-Sep-07 2:12 
AnswerRe: Go to a particular node. Pin
Scott Dorman12-Sep-07 8:20
professionalScott Dorman12-Sep-07 8:20 
GeneralRe: Go to a particular node. [modified] Pin
P_Elza12-Sep-07 17:01
P_Elza12-Sep-07 17:01 
This is the xml
<?xml version="1.0" encoding="UTF-8" ?>
<family>
<name gender="male">
<firstname>Tom</firstname>
<lastname>Smith</lastname>
</name>
</family>

and the code is --------

FileStream fs = new FileStream("D:\\Myfolder\\gender.xml", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
xmldoc.Load(fs);
XmlNodeList xmlnode = xmldoc.GetElementsByTagName("name");
for (int a = 0; a < xmlnode.Count; a++)
{
if (xmlnode[a].Attributes[0].Value == "gender")
// match your attributes
{ //codes
lblcnt.Text=a.ToString();
String firstNameValue = reader.ReadElementString("gender");
Lblmsg.Text=" FirstName: "+firstNameValue;
}
I tried this one also=======
XmlTextReader reader = new XmlTextReader ("D:\\Myfolder\\gender.xml");
XmlDocument xmldoc = new XmlDocument();
XmlTextReader reader = new XmlTextReader ("C:\\gender.xml");
try
{
while (!reader.EOF)
{
reader.Read();
if(reader.IsStartElement() )
{
reader.Read();
xmldoc.SelectSingleNode("family/name/firstname");
XmlNode xmlnode1=xmldoc.GetElementsByTagName("firstname");
String firstNameValue = reader.ReadElementString("firstname");
xmldoc.SelectSingleNode("lastname");
String lastNameValue = reader.ReadElementString("lastname");
Lblmsg.Text=" FirstName: "+firstNameValue + " LastName: " + lastNameValue;
}
}
reader.Close();
}
catch (Exception err )
{
Lblmsg.Text="Error: " + err.ToString();
}

Confused | :confused:


-- modified at 23:06 Wednesday 12th September, 2007
QuestionHash Table Pin
Nishad8512-Sep-07 0:07
Nishad8512-Sep-07 0:07 

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.