Click here to Skip to main content
15,896,474 members
Home / Discussions / C#
   

C#

 
GeneralSET Value of Arbitrary ListBox Item Pin
Sukhjinder_K12-Sep-07 23:33
Sukhjinder_K12-Sep-07 23:33 
GeneralRe: SET Value of Arbitrary ListBox Item Pin
Pete O'Hanlon12-Sep-07 23:55
mvePete O'Hanlon12-Sep-07 23:55 
GeneralRe: SET Value of Arbitrary ListBox Item Pin
Sukhjinder_K13-Sep-07 0:13
Sukhjinder_K13-Sep-07 0:13 
GeneralRe: SET Value of Arbitrary ListBox Item Pin
Pete O'Hanlon13-Sep-07 0:33
mvePete O'Hanlon13-Sep-07 0:33 
GeneralRe: SET Value of Arbitrary ListBox Item Pin
Sukhjinder_K13-Sep-07 1:59
Sukhjinder_K13-Sep-07 1:59 
AnswerRe: Get Value of Arbitrary ListBox Item Pin
pmarfleet12-Sep-07 22:15
pmarfleet12-Sep-07 22:15 
AnswerRe: Get Value of Arbitrary ListBox Item Pin
Luc Pattyn13-Sep-07 1:19
sitebuilderLuc Pattyn13-Sep-07 1:19 
QuestionPlz help me to go to a particular node in xml file Pin
P_Elza12-Sep-07 17:15
P_Elza12-Sep-07 17:15 
am trying to develop one aplication to read a particular node in an xml file. but somewhere i goes wrong and not working.......
plz help me to find out the error.....
In the following xml file i want to find out the last name.

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:25 Wednesday 12th September, 2007
AnswerRe: Plz help me to go to a particular node in xml file Pin
Christian Graus12-Sep-07 18:39
protectorChristian Graus12-Sep-07 18:39 
AnswerRe: Plz help me to go to a particular node in xml file Pin
Jintal Patel12-Sep-07 19:15
Jintal Patel12-Sep-07 19:15 
AnswerRe: Plz help me to go to a particular node in xml file Pin
Nouman Bhatti12-Sep-07 19:27
Nouman Bhatti12-Sep-07 19:27 
AnswerRe: Plz help me to go to a particular node in xml file Pin
P_Elza12-Sep-07 21:52
P_Elza12-Sep-07 21:52 
QuestionSaving username and password Pin
C#Coudou12-Sep-07 15:33
C#Coudou12-Sep-07 15:33 
AnswerRe: Saving username and password Pin
Christian Graus12-Sep-07 15:50
protectorChristian Graus12-Sep-07 15:50 
QuestionReading data from a dataset with a checkedlistbox Pin
falles0112-Sep-07 15:28
falles0112-Sep-07 15:28 
AnswerRe: Reading data from a dataset with a checkedlistbox Pin
Christian Graus12-Sep-07 18:52
protectorChristian Graus12-Sep-07 18:52 
GeneralRe: Reading data from a dataset with a checkedlistbox Pin
falles0112-Sep-07 19:00
falles0112-Sep-07 19:00 
GeneralRe: Reading data from a dataset with a checkedlistbox Pin
Christian Graus13-Sep-07 3:10
protectorChristian Graus13-Sep-07 3:10 
GeneralRe: Reading data from a dataset with a checkedlistbox Pin
falles0113-Sep-07 15:12
falles0113-Sep-07 15:12 
GeneralRe: Reading data from a dataset with a checkedlistbox Pin
falles0113-Sep-07 15:17
falles0113-Sep-07 15:17 
GeneralRe: Reading data from a dataset with a checkedlistbox Pin
falles0113-Sep-07 15:30
falles0113-Sep-07 15:30 
QuestionDrawing a line to a bitmap Pin
Klazen12-Sep-07 13:31
Klazen12-Sep-07 13:31 
AnswerRe: Drawing a line to a bitmap Pin
Christian Graus12-Sep-07 13:45
protectorChristian Graus12-Sep-07 13:45 
GeneralRe: Drawing a line to a bitmap Pin
Klazen12-Sep-07 14:12
Klazen12-Sep-07 14:12 
GeneralRe: Drawing a line to a bitmap Pin
Christian Graus12-Sep-07 14:28
protectorChristian Graus12-Sep-07 14:28 

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.