Click here to Skip to main content
14,367,061 members
Rate this:
Please Sign up or sign in to 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


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.
John C Rayan 5-Mar-15 8:45am
   
lblversion.Text = updateversion.ToString();

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

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


label.Text = myNode["nodename"].InnerText;
   
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100