Note that there are some explanatory texts on larger screens.

plurals
  1. POproblems with array and function and xml
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/12168330/how-to-make-this-array-function-to-work">How to make this array + function to work?</a> </p> </blockquote> <p>i need help with my array hope someone can tell me how i can do this.</p> <p>This is my function, what I'm trying to do is to post the array on XML file (I'm new on this)</p> <pre><code>// ------------------- Functions static void XML_Array(Dictionary&lt;string, string&gt; Data_Array) { foreach (KeyValuePair&lt;string, string&gt; kvp in Data_Array) { if (kvp.Key == "XML_File") { String xmlfile = kvp.Value; } XmlTextWriter xwriter = new XmlTextWriter(xmlfile, Encoding.Unicode); xwriter.WriteStartDocument(); if (kvp.Key == "StartElement") { xwriter.WriteStartElement(kvp.Value); } foreach (KeyValuePair&lt;string, string&gt; kvp2 in Elements_Array) { String Element_Name = kvp2.Key; String Element_Value = kvp2.Value.ToString(); xwriter.WriteStartElement(Element_Name); xwriter.WriteString(Element_Value); xwriter.WriteEndElement(); } xwriter.WriteEndDocument(); xwriter.Close(); } } </code></pre> <p>My Array Code is this, when i press the button2 the array is going to the function</p> <pre><code> private void button2_Click(object sender, EventArgs e) { Dictionary&lt;string, string&gt; Data_Array = new Dictionary&lt;string, string&gt;(); Data_Array.Add("XML_File", "Settings_Data.xml"); Data_Array.Add("StartElement", "XMLFILE"); Dictionary&lt;string, string&gt; Elements_Array = new Dictionary&lt;string, string&gt;(); Elements_Array.Add("Name", textBox3.Text); Elements_Array.Add("Age", textBox4.Text); Elements_Array.Add("Gentle", comboBox6.SelectedIndex); Data_Array.Add("Elements_Array", Elements_Array); XML_Array(Data_Array); } </code></pre> <p><strong>Update:</strong><br /> The problem is and of course the question is how i can make on function where is String xmlfile = to show me the XML_File value = Settings_Data.xml</p> <p>and one more problem is Data_Array.Add("Elements_Array", Elements_Array); i get error on this part</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload