Click here to Skip to main content
15,888,521 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to get value from form 1 to form 2 Pin
ash_ng18-Oct-10 20:07
ash_ng18-Oct-10 20:07 
GeneralRe: how to get value from form 1 to form 2 Pin
Calla18-Oct-10 20:19
Calla18-Oct-10 20:19 
GeneralRe: how to get value from form 1 to form 2 Pin
DaveyM6919-Oct-10 0:04
professionalDaveyM6919-Oct-10 0:04 
AnswerRe: how to get value from form 1 to form 2 Pin
Varun Sareen18-Oct-10 22:26
Varun Sareen18-Oct-10 22:26 
GeneralRe: how to get value from form 1 to form 2 Pin
OriginalGriff18-Oct-10 23:44
mveOriginalGriff18-Oct-10 23:44 
AnswerRe: how to get value from form 1 to form 2 Pin
johannesnestler19-Oct-10 3:37
johannesnestler19-Oct-10 3:37 
AnswerRe: how to get value from form 1 to form 2 Pin
Jeff Connelly19-Oct-10 4:26
Jeff Connelly19-Oct-10 4:26 
QuestionWriting/show a Variable/Result into a XML File Pin
glenki18-Oct-10 12:10
glenki18-Oct-10 12:10 
Hi (im German so please forgive my bad english),

I wrote a c# .net 4.0 Program that gives me results from different calculations into different variables with different datatypes (myInt, myDouble, myString, myBool, myWhatevr)

Now i wanted to give al this results to my xml file that is used as a logfile.
This is my xml code:

using System;
using System.Xml;

namespace xml_exporter
{

    public class xml_tool
    {
       
        public static void tel_toXML()
        {
            string dateTime = DateTime.Now.ToString("yyyyMMddhhmmss");

            XmlTextWriter myXmlTextWriter = new XmlTextWriter("C:\\XML-Log_" + dateTime + ".xml", System.Text.Encoding.UTF8);
            myXmlTextWriter.Formatting = Formatting.Indented;
            myXmlTextWriter.WriteStartDocument(true);
            myXmlTextWriter.WriteStartElement("Data");
           
           myXmlTextWriter.WriteComment("Start");
           
            myXmlTextWriter.WriteElementString("Farbe", "Blau");  //non variable value "blau"
            myXmlTextWriter.WriteElementString("Struktur:", "Rau");
            myXmlTextWriter.WriteComment("Farbnummer" ""); //now variable value's => ("Colornumber" "myint");
            myXmlTextWriter.WriteElementString("Dichte", ""); //myDouble
            myXmlTextWriter.WriteElementString("Name", ""); //myString
            myXmlTextWriter.WriteElementString("Aktiv", ""); //myBool
           
            myXmlTextWriter.WriteComment("End");

            myXmlTextWriter.WriteEndElement();
           
            myXmlTextWriter.Flush();
            myXmlTextWriter.Close();

       }
    }
}


Now i want to know how to give my variabel values to the xml construct!?

so that the xml-file should look "like" this:

 Colornumber  ValueOfmyInt variable Colornumber <br />
..<br />
 Dichte 5.4 Dichte 



etc.

However I searched in the c# openbook, msdn I didnt found the right answer to my problem. And there must be a Code or a Command to give the values of my variable to the XML thing.

I'm just always finding "how to read from xml" and stuff but thats not the same I think. Im still trying to build something up but its not working.
Ich flehe um Hilfe!

Does anyone have an idea how i can realise this ? Or a Link for exact this problem etc.? It would be a very big help for me.


greetz,
Sal
AnswerRe: Writing/show a Variable/Result into a XML File Pin
Luc Pattyn18-Oct-10 13:02
sitebuilderLuc Pattyn18-Oct-10 13:02 
GeneralRe: Writing/show a Variable/Result into a XML File [modified] Pin
glenki18-Oct-10 13:17
glenki18-Oct-10 13:17 
GeneralRe: Writing/show a Variable/Result into a XML File Pin
Richard MacCutchan18-Oct-10 22:42
mveRichard MacCutchan18-Oct-10 22:42 
QuestionDialing modem Pin
Evgeni5718-Oct-10 8:45
Evgeni5718-Oct-10 8:45 
AnswerRe: Dialing modem Pin
T M Gray18-Oct-10 10:30
T M Gray18-Oct-10 10:30 
GeneralRe: Dialing modem Pin
Evgeni5718-Oct-10 10:34
Evgeni5718-Oct-10 10:34 
QuestionRe: Dialing modem Pin
monstale18-Oct-10 19:44
monstale18-Oct-10 19:44 
AnswerRe: Dialing modem Pin
Evgeni5718-Oct-10 22:04
Evgeni5718-Oct-10 22:04 
GeneralRe: Dialing modem Pin
monstale18-Oct-10 22:48
monstale18-Oct-10 22:48 
GeneralRe: Dialing modem Pin
Evgeni5718-Oct-10 23:39
Evgeni5718-Oct-10 23:39 
AnswerRe: Dialing modem Pin
Luc Pattyn18-Oct-10 11:02
sitebuilderLuc Pattyn18-Oct-10 11:02 
GeneralRe: Dialing modem Pin
Evgeni5718-Oct-10 22:23
Evgeni5718-Oct-10 22:23 
AnswerRe: Dialing modem Pin
Rajesh Anuhya19-Oct-10 18:25
professionalRajesh Anuhya19-Oct-10 18:25 
GeneralRe: Dialing modem Pin
Evgeni5719-Oct-10 21:53
Evgeni5719-Oct-10 21:53 
GeneralRe: Dialing modem Pin
Rajesh Anuhya19-Oct-10 23:07
professionalRajesh Anuhya19-Oct-10 23:07 
AnswerRe: Dialing modem Pin
Chuck Richards2-Jun-11 8:54
Chuck Richards2-Jun-11 8:54 
QuestionWMI and SNMP Pin
Roland Bär18-Oct-10 5:24
Roland Bär18-Oct-10 5:24 

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.