writing a timestamp to a xml file.
-
Hey all. On a new project im working on, which is about learning different areas in visual basic. One area i havnt covered much is writing to files and retrieving data from a file. The program includes a update script, which justs checks online reading a .txt file to see if the version is newer, if so it downloads it. I would like to record when the user last press 'checkForUpdates' button. Take the timestamp and write it into a xml file. Then using a simple label to read and display the value inside the xml file. I have been trying a few ways, just using timestamps i got lost. Any help would be great, Malcom
-
Hey all. On a new project im working on, which is about learning different areas in visual basic. One area i havnt covered much is writing to files and retrieving data from a file. The program includes a update script, which justs checks online reading a .txt file to see if the version is newer, if so it downloads it. I would like to record when the user last press 'checkForUpdates' button. Take the timestamp and write it into a xml file. Then using a simple label to read and display the value inside the xml file. I have been trying a few ways, just using timestamps i got lost. Any help would be great, Malcom
-
If you can show the code you have tried and explain the exact problem, it would be easier to help.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
Oki sorry, i asked wrong, i have tried some ways but i can't get it to work. Im not asking for the answer, that be wrong. I am learning it afterall. I just need say a boost. Just a quick example of generating a timestamp then i can work it from there. I did some googling and believe i can easly use xml file just need to mess around abit more. Sorry for the bother, Malcom
-
Oki sorry, i asked wrong, i have tried some ways but i can't get it to work. Im not asking for the answer, that be wrong. I am learning it afterall. I just need say a boost. Just a quick example of generating a timestamp then i can work it from there. I did some googling and believe i can easly use xml file just need to mess around abit more. Sorry for the bother, Malcom
-
Oki sorry, i asked wrong, i have tried some ways but i can't get it to work. Im not asking for the answer, that be wrong. I am learning it afterall. I just need say a boost. Just a quick example of generating a timestamp then i can work it from there. I did some googling and believe i can easly use xml file just need to mess around abit more. Sorry for the bother, Malcom
hi, here i have some code for you.
System.Xml.XmlTextWriter xtw = new System.Xml.XmlTextWriter("C:\\timestamp.xml",System.Text.Encoding.UTF8);
// XmlFormatting
xtw.Formatting == Formatting.Indented;
xtw.Indentation = 4;xtw.WriteStartDocument();
// write into a element as inner text
xtw.WriteStartElement("TimeStamp");
xtw.WriteString(DateTime.Now.ToOADate());
xtw.WriteEndElement();// Write into a element as attribute
xtw.WriteStartElement("TimeStampAttribute");
xtw.WriteAttributeString("DateTime",DateTime.Now.ToOADate())
xtw.WriteEndElement();xtw.WriteEndDocument();
xtw.Close(); -
hi, here i have some code for you.
System.Xml.XmlTextWriter xtw = new System.Xml.XmlTextWriter("C:\\timestamp.xml",System.Text.Encoding.UTF8);
// XmlFormatting
xtw.Formatting == Formatting.Indented;
xtw.Indentation = 4;xtw.WriteStartDocument();
// write into a element as inner text
xtw.WriteStartElement("TimeStamp");
xtw.WriteString(DateTime.Now.ToOADate());
xtw.WriteEndElement();// Write into a element as attribute
xtw.WriteStartElement("TimeStampAttribute");
xtw.WriteAttributeString("DateTime",DateTime.Now.ToOADate())
xtw.WriteEndElement();xtw.WriteEndDocument();
xtw.Close();