Hello guys,
I am trying to get this code work for about 2 hours =( I am new to C# and don't know all the .NET library classes.
The target is to populate XML data to comboBox
DataSet dataSet = new DataSet();
DataTable dataTable = new DataTable("table1");
dataTable.Columns.Add("col1", typeof(string));
dataSet.Tables.Add(dataTable);
StringReader strR = new StringReader("<root><parm1>val1</parm1><parm2>val2</parm2></root>");
dataSet.ReadXml(strR);
comboBox1.DataSource = dataSet.Tables[0];
comboBox1.DisplayMember = "col1";
comboBox1.ValueMember = "col1";
Well, it doesn't work as expected. The ComboBox should show val1 val2
I don't really understand how column names of DataTable in a DataSet are related to XML-Tags... Maybe that's the point?
Thank You in advance!