I have an xml file which i want to increment the version number each time the user click btnNewfile. it must start from 1000 and increment to by 1. I am also confused on which version must increment or both. the problem is the format when i try to debug. how can i increment it?
xml
<resheader name="version">
<value>2.0</value>
</resheader>
what i have done
private void btnNewfile_Click(object sender, EventArgs e)
{
int current = 1000;
current++;
var versionNumber = doc.Descendants("value").FirstOrDefault();
current = (int)versionNumber;
versionNumber.SetValue(current + 1); //error here;Input string was not in a correct format.
lbl_Output_Version.Text = versionNumber.ToString();
}
the problem comes here as i have these two
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> // i only want to update this one
when i debug it is getting the first one with "text/microsoft-resx" and it throws error after that.
Aucun commentaire:
Enregistrer un commentaire