Click here to Skip to main content
15,506,209 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Am trying to update my label so that when the user click new button it must get the xmlnode and update the number to a string. how can i do that


C#
int updateversion = 1000;
                updateversion++;
                XmlNode myNode = root.SelectSingleNode("descendant::resheader[@name = 'version']/value");
                myNode.InnerText = updateversion.ToString();
                lblversion.Text = myNode.ToString();
Posted
Updated 5-Mar-15 3:18am
v3
Comments
ZurdoDev 5-Mar-15 8:25am    
What's wrong with your code?
Bacanzela 5-Mar-15 8:34am    
it doesn't update the lable
ZurdoDev 5-Mar-15 8:36am    
lblversion.Text = myNode.ToString(); does something.
Bacanzela 5-Mar-15 8:40am    
it is not
ZurdoDev 5-Mar-15 8:42am    
If the code hits that line, then yes, it is converting myNode to a string and putting it in the lblversion. You need to do some debugging and then explain what is happening.

1 solution

myNode is just the object, you need to tell what you want to get from that object


C#
label.Text = myNode["nodename"].InnerText;
 
Share this answer
 
Comments
Bacanzela 5-Mar-15 16:44pm    
Object reference not set to an instance of an object.
Gonzoox 5-Mar-15 16:48pm    
you're changing the "nodename" part to what you actually have right??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900