Help with XML to datagridview
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Thread: Help with XML to datagridview

  1. #1
    Join Date
    Apr 2017
    Posts
    7

    Question Help with XML to datagridview

    Hi,
    I'm trying to pull data xml and display in datagridview.
    here's an example of the XML -

    Code:
    <?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
    <ramp>
    	<header>
    		<version>2</version>
    		<checksum>18290949</checksum>
    	</header>
    	<colors>
    		<deep_red>
    			<point>
    				<intensity>0</intensity>
    				<time>0</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>360</time>
    			</point>
    			<point>
    				<intensity>19</intensity>
    				<time>480</time>
    			</point>
    		</deep_red>
    		<blue>
    			<point>
    				<intensity>0</intensity>
    				<time>0</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>360</time>
    			</point>
    			<point>
    				<intensity>22</intensity>
    				<time>480</time>
    			</point>
    		</blue>
    	</colors>
    </ramp>

    I want to display the colors as the column name and the time (0, 360, 480) as the row label with intensity as the row value

    Ie.

    Deep Red Blue
    0 0 0
    360 0 0
    480 19 22

    Here's the code I have already... I can get the column headings fine but cant figure out how to get the values in to the rows in the DataGridView

    Code:
    public static DataTable GetRecords(string file)		{
    			//DataTable that will hold the found results
    			DataTable results = new DataTable("SearchResults");
    			//DataRow (used later)
    			DataRow row = null;
    
    			XmlDocument doc = new XmlDocument();
    			doc.Load(file);
    
    			//build the table
    			//** Change This **
    			string query = "/ramp/colors";
    
    			//now we loop through the list
    			foreach(XmlNode node in doc.SelectNodes(query))
    			{
    				row = results.NewRow();
    
    					
    					results.Columns.Add(node.ChildNodes[0].Name, typeof(string));
    					results.Columns.Add(node.ChildNodes[1].Name, typeof(string));
    					results.Columns.Add(node.ChildNodes[2].Name, typeof(string));
    					results.Columns.Add(node.ChildNodes[3].Name, typeof(string));
    					results.Columns.Add(node.ChildNodes[4].Name, typeof(string));
    					results.Columns.Add(node.ChildNodes[5].Name, typeof(string));
    					results.Columns.Add(node.ChildNodes[6].Name, typeof(string));
    					row[0] = node.ChildNodes[0].ChildNodes[0].ChildNodes[0].InnerText;
    					row[2] = node.ChildNodes[0].ChildNodes[0].ChildNodes[0].InnerText;
    					row[3] = node.ChildNodes[0].ChildNodes[0].ChildNodes[0].InnerText;
    					row[4] = node.ChildNodes[0].ChildNodes[0].ChildNodes[0].InnerText;
    					row[5] = node.ChildNodes[0].ChildNodes[0].ChildNodes[0].InnerText;
    					row[6] = node.ChildNodes[0].ChildNodes[0].ChildNodes[0].InnerText;
    					
    
    					//now add the row
    					results.Rows.Add(row);
    				
    			}
    
    			//now return the DataTable
    			return results;
    		}
    Thanks
    Craig.

  2. #2
    Join Date
    Apr 2017
    Posts
    7

    Re: Help with XML to datagridview

    update, I figured out how to get the info from the xml file, however, the rows and columns are giving me jip

    Name:  Capture.jpg
Views: 98
Size:  20.9 KB

    Code:
    int i = 0;
    			foreach(XmlNode node in doc.SelectNodes(query))
    			{
    				row = results.NewRow();
    					 XmlNode Element = (XmlNode)node;
    					 foreach (XmlNode node1 in Element)
                         {
                            XmlNode Element1 = (XmlNode)node1;
                            results.Columns.Add(Element1.Name, typeof(string)); //(Colour)
    					 }
                            foreach (XmlNode node2 in Element)
                            {
                            	XmlNode Element2 = (XmlNode)node2;
                            	foreach (XmlNode node3 in Element2) // Colour
                            	{
                            		XmlNode Element3 = (XmlNode)node3; // (Intesity)
                            		foreach (XmlNode node4 in Element3)
                            		{
    									XmlNode Element4 = (XmlNode)node4;
                            			if (Element4.Name == "intensity")
                            			{
                            						row[i] = Element4.InnerText.ToString();
                            						results.Rows.Add(row);
                            						row = results.NewRow();
                            			}
                            		}
                            	}
                            	i++;
                            }
    					 
    								
    			}
    
    			//now return the DataTable
    			return results;

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,588

    Re: Help with XML to datagridview

    A couple of questions:
    1) does your example xml represent one row? If so, do you have an xml example that shows multiple rows?
    2) Can you show the grid columns and how the xml data is displayed in those columns?

  4. #4
    Join Date
    Apr 2017
    Posts
    7

    Re: Help with XML to datagridview

    Quote Originally Posted by Arjay View Post
    A couple of questions:
    1) does your example xml represent one row? If so, do you have an xml example that shows multiple rows?
    2) Can you show the grid columns and how the xml data is displayed in those columns?
    Cant figure out how to attach a file so have pasted it here -

    Code:
    <?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
    <ramp>
    	<header>
    		<version>2</version>
    		<checksum>18290949</checksum>
    	</header>
    	<colors>
    		<deep_red>
    			<point>
    				<intensity>0</intensity>
    				<time>0</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>360</time>
    			</point>
    			<point>
    				<intensity>19</intensity>
    				<time>480</time>
    			</point>
    			<point>
    				<intensity>37</intensity>
    				<time>490</time>
    			</point>
    			<point>
    				<intensity>51</intensity>
    				<time>500</time>
    			</point>
    			<point>
    				<intensity>47</intensity>
    				<time>510</time>
    			</point>
    			<point>
    				<intensity>60</intensity>
    				<time>520</time>
    			</point>
    			<point>
    				<intensity>60</intensity>
    				<time>530</time>
    			</point>
    			<point>
    				<intensity>51</intensity>
    				<time>540</time>
    			</point>
    			<point>
    				<intensity>37</intensity>
    				<time>550</time>
    			</point>
    			<point>
    				<intensity>56</intensity>
    				<time>560</time>
    			</point>
    			<point>
    				<intensity>47</intensity>
    				<time>570</time>
    			</point>
    			<point>
    				<intensity>51</intensity>
    				<time>580</time>
    			</point>
    			<point>
    				<intensity>47</intensity>
    				<time>590</time>
    			</point>
    			<point>
    				<intensity>65</intensity>
    				<time>600</time>
    			</point>
    			<point>
    				<intensity>23</intensity>
    				<time>610</time>
    			</point>
    			<point>
    				<intensity>9</intensity>
    				<time>620</time>
    			</point>
    			<point>
    				<intensity>42</intensity>
    				<time>630</time>
    			</point>
    			<point>
    				<intensity>33</intensity>
    				<time>640</time>
    			</point>
    			<point>
    				<intensity>37</intensity>
    				<time>650</time>
    			</point>
    			<point>
    				<intensity>47</intensity>
    				<time>660</time>
    			</point>
    			<point>
    				<intensity>51</intensity>
    				<time>670</time>
    			</point>
    			<point>
    				<intensity>14</intensity>
    				<time>680</time>
    			</point>
    			<point>
    				<intensity>70</intensity>
    				<time>690</time>
    			</point>
    			<point>
    				<intensity>33</intensity>
    				<time>700</time>
    			</point>
    			<point>
    				<intensity>23</intensity>
    				<time>710</time>
    			</point>
    			<point>
    				<intensity>19</intensity>
    				<time>720</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>730</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>740</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>750</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>760</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>770</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>780</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>790</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>800</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>810</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>820</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>830</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>840</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>850</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>860</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>870</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>880</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>910</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>930</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>950</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>970</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1020</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1110</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1130</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1140</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1150</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1160</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1170</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1180</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1190</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1220</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1270</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1290</time>
    			</point>
    		</deep_red>
    		<uv>
    			<point>
    				<intensity>0</intensity>
    				<time>0</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>360</time>
    			</point>
    			<point>
    				<intensity>22</intensity>
    				<time>480</time>
    			</point>
    			<point>
    				<intensity>55</intensity>
    				<time>490</time>
    			</point>
    			<point>
    				<intensity>77</intensity>
    				<time>500</time>
    			</point>
    			<point>
    				<intensity>98</intensity>
    				<time>510</time>
    			</point>
    			<point>
    				<intensity>119</intensity>
    				<time>520</time>
    			</point>
    			<point>
    				<intensity>161</intensity>
    				<time>530</time>
    			</point>
    			<point>
    				<intensity>192</intensity>
    				<time>540</time>
    			</point>
    			<point>
    				<intensity>211</intensity>
    				<time>550</time>
    			</point>
    			<point>
    				<intensity>230</intensity>
    				<time>560</time>
    			</point>
    			<point>
    				<intensity>249</intensity>
    				<time>570</time>
    			</point>
    			<point>
    				<intensity>279</intensity>
    				<time>580</time>
    			</point>
    			<point>
    				<intensity>297</intensity>
    				<time>590</time>
    			</point>
    			<point>
    				<intensity>315</intensity>
    				<time>600</time>
    			</point>
    			<point>
    				<intensity>332</intensity>
    				<time>610</time>
    			</point>
    			<point>
    				<intensity>349</intensity>
    				<time>620</time>
    			</point>
    			<point>
    				<intensity>377</intensity>
    				<time>630</time>
    			</point>
    			<point>
    				<intensity>404</intensity>
    				<time>640</time>
    			</point>
    			<point>
    				<intensity>420</intensity>
    				<time>650</time>
    			</point>
    			<point>
    				<intensity>435</intensity>
    				<time>660</time>
    			</point>
    			<point>
    				<intensity>391</intensity>
    				<time>670</time>
    			</point>
    			<point>
    				<intensity>442</intensity>
    				<time>680</time>
    			</point>
    			<point>
    				<intensity>433</intensity>
    				<time>690</time>
    			</point>
    			<point>
    				<intensity>433</intensity>
    				<time>700</time>
    			</point>
    			<point>
    				<intensity>479</intensity>
    				<time>710</time>
    			</point>
    			<point>
    				<intensity>451</intensity>
    				<time>720</time>
    			</point>
    			<point>
    				<intensity>386</intensity>
    				<time>730</time>
    			</point>
    			<point>
    				<intensity>414</intensity>
    				<time>740</time>
    			</point>
    			<point>
    				<intensity>386</intensity>
    				<time>750</time>
    			</point>
    			<point>
    				<intensity>363</intensity>
    				<time>760</time>
    			</point>
    			<point>
    				<intensity>414</intensity>
    				<time>770</time>
    			</point>
    			<point>
    				<intensity>367</intensity>
    				<time>780</time>
    			</point>
    			<point>
    				<intensity>419</intensity>
    				<time>790</time>
    			</point>
    			<point>
    				<intensity>358</intensity>
    				<time>800</time>
    			</point>
    			<point>
    				<intensity>330</intensity>
    				<time>810</time>
    			</point>
    			<point>
    				<intensity>312</intensity>
    				<time>820</time>
    			</point>
    			<point>
    				<intensity>381</intensity>
    				<time>830</time>
    			</point>
    			<point>
    				<intensity>386</intensity>
    				<time>840</time>
    			</point>
    			<point>
    				<intensity>326</intensity>
    				<time>850</time>
    			</point>
    			<point>
    				<intensity>400</intensity>
    				<time>860</time>
    			</point>
    			<point>
    				<intensity>284</intensity>
    				<time>870</time>
    			</point>
    			<point>
    				<intensity>326</intensity>
    				<time>880</time>
    			</point>
    			<point>
    				<intensity>372</intensity>
    				<time>910</time>
    			</point>
    			<point>
    				<intensity>293</intensity>
    				<time>930</time>
    			</point>
    			<point>
    				<intensity>288</intensity>
    				<time>950</time>
    			</point>
    			<point>
    				<intensity>242</intensity>
    				<time>970</time>
    			</point>
    			<point>
    				<intensity>237</intensity>
    				<time>1020</time>
    			</point>
    			<point>
    				<intensity>237</intensity>
    				<time>1110</time>
    			</point>
    			<point>
    				<intensity>195</intensity>
    				<time>1130</time>
    			</point>
    			<point>
    				<intensity>163</intensity>
    				<time>1140</time>
    			</point>
    			<point>
    				<intensity>158</intensity>
    				<time>1150</time>
    			</point>
    			<point>
    				<intensity>144</intensity>
    				<time>1160</time>
    			</point>
    			<point>
    				<intensity>130</intensity>
    				<time>1170</time>
    			</point>
    			<point>
    				<intensity>149</intensity>
    				<time>1180</time>
    			</point>
    			<point>
    				<intensity>70</intensity>
    				<time>1190</time>
    			</point>
    			<point>
    				<intensity>19</intensity>
    				<time>1220</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1270</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1290</time>
    			</point>
    		</uv>
    		<deep_blue>
    			<point>
    				<intensity>0</intensity>
    				<time>0</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>480</time>
    			</point>
    			<point>
    				<intensity>967</intensity>
    				<time>770</time>
    			</point>
    			<point>
    				<intensity>1000</intensity>
    				<time>780</time>
    			</point>
    			<point>
    				<intensity>1000</intensity>
    				<time>1020</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1320</time>
    			</point>
    		</deep_blue>
    		<violet>
    			<point>
    				<intensity>0</intensity>
    				<time>0</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>360</time>
    			</point>
    			<point>
    				<intensity>22</intensity>
    				<time>480</time>
    			</point>
    			<point>
    				<intensity>66</intensity>
    				<time>490</time>
    			</point>
    			<point>
    				<intensity>76</intensity>
    				<time>500</time>
    			</point>
    			<point>
    				<intensity>108</intensity>
    				<time>510</time>
    			</point>
    			<point>
    				<intensity>140</intensity>
    				<time>520</time>
    			</point>
    			<point>
    				<intensity>171</intensity>
    				<time>530</time>
    			</point>
    			<point>
    				<intensity>202</intensity>
    				<time>540</time>
    			</point>
    			<point>
    				<intensity>210</intensity>
    				<time>550</time>
    			</point>
    			<point>
    				<intensity>229</intensity>
    				<time>560</time>
    			</point>
    			<point>
    				<intensity>259</intensity>
    				<time>570</time>
    			</point>
    			<point>
    				<intensity>288</intensity>
    				<time>580</time>
    			</point>
    			<point>
    				<intensity>351</intensity>
    				<time>590</time>
    			</point>
    			<point>
    				<intensity>391</intensity>
    				<time>600</time>
    			</point>
    			<point>
    				<intensity>441</intensity>
    				<time>610</time>
    			</point>
    			<point>
    				<intensity>503</intensity>
    				<time>620</time>
    			</point>
    			<point>
    				<intensity>553</intensity>
    				<time>630</time>
    			</point>
    			<point>
    				<intensity>602</intensity>
    				<time>640</time>
    			</point>
    			<point>
    				<intensity>651</intensity>
    				<time>650</time>
    			</point>
    			<point>
    				<intensity>856</intensity>
    				<time>660</time>
    			</point>
    			<point>
    				<intensity>800</intensity>
    				<time>670</time>
    			</point>
    			<point>
    				<intensity>674</intensity>
    				<time>680</time>
    			</point>
    			<point>
    				<intensity>586</intensity>
    				<time>690</time>
    			</point>
    			<point>
    				<intensity>637</intensity>
    				<time>700</time>
    			</point>
    			<point>
    				<intensity>651</intensity>
    				<time>710</time>
    			</point>
    			<point>
    				<intensity>805</intensity>
    				<time>720</time>
    			</point>
    			<point>
    				<intensity>647</intensity>
    				<time>730</time>
    			</point>
    			<point>
    				<intensity>647</intensity>
    				<time>740</time>
    			</point>
    			<point>
    				<intensity>805</intensity>
    				<time>750</time>
    			</point>
    			<point>
    				<intensity>605</intensity>
    				<time>760</time>
    			</point>
    			<point>
    				<intensity>600</intensity>
    				<time>770</time>
    			</point>
    			<point>
    				<intensity>772</intensity>
    				<time>780</time>
    			</point>
    			<point>
    				<intensity>656</intensity>
    				<time>790</time>
    			</point>
    			<point>
    				<intensity>665</intensity>
    				<time>800</time>
    			</point>
    			<point>
    				<intensity>716</intensity>
    				<time>810</time>
    			</point>
    			<point>
    				<intensity>605</intensity>
    				<time>820</time>
    			</point>
    			<point>
    				<intensity>609</intensity>
    				<time>830</time>
    			</point>
    			<point>
    				<intensity>698</intensity>
    				<time>840</time>
    			</point>
    			<point>
    				<intensity>533</intensity>
    				<time>850</time>
    			</point>
    			<point>
    				<intensity>628</intensity>
    				<time>860</time>
    			</point>
    			<point>
    				<intensity>702</intensity>
    				<time>870</time>
    			</point>
    			<point>
    				<intensity>549</intensity>
    				<time>880</time>
    			</point>
    			<point>
    				<intensity>758</intensity>
    				<time>910</time>
    			</point>
    			<point>
    				<intensity>688</intensity>
    				<time>930</time>
    			</point>
    			<point>
    				<intensity>623</intensity>
    				<time>950</time>
    			</point>
    			<point>
    				<intensity>912</intensity>
    				<time>970</time>
    			</point>
    			<point>
    				<intensity>763</intensity>
    				<time>1020</time>
    			</point>
    			<point>
    				<intensity>684</intensity>
    				<time>1110</time>
    			</point>
    			<point>
    				<intensity>693</intensity>
    				<time>1130</time>
    			</point>
    			<point>
    				<intensity>572</intensity>
    				<time>1140</time>
    			</point>
    			<point>
    				<intensity>535</intensity>
    				<time>1150</time>
    			</point>
    			<point>
    				<intensity>372</intensity>
    				<time>1160</time>
    			</point>
    			<point>
    				<intensity>344</intensity>
    				<time>1170</time>
    			</point>
    			<point>
    				<intensity>219</intensity>
    				<time>1180</time>
    			</point>
    			<point>
    				<intensity>195</intensity>
    				<time>1190</time>
    			</point>
    			<point>
    				<intensity>107</intensity>
    				<time>1220</time>
    			</point>
    			<point>
    				<intensity>47</intensity>
    				<time>1270</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1290</time>
    			</point>
    		</violet>
    		<cool_white>
    			<point>
    				<intensity>0</intensity>
    				<time>0</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>360</time>
    			</point>
    			<point>
    				<intensity>19</intensity>
    				<time>480</time>
    			</point>
    			<point>
    				<intensity>42</intensity>
    				<time>490</time>
    			</point>
    			<point>
    				<intensity>74</intensity>
    				<time>500</time>
    			</point>
    			<point>
    				<intensity>149</intensity>
    				<time>510</time>
    			</point>
    			<point>
    				<intensity>144</intensity>
    				<time>520</time>
    			</point>
    			<point>
    				<intensity>121</intensity>
    				<time>530</time>
    			</point>
    			<point>
    				<intensity>116</intensity>
    				<time>540</time>
    			</point>
    			<point>
    				<intensity>130</intensity>
    				<time>550</time>
    			</point>
    			<point>
    				<intensity>135</intensity>
    				<time>560</time>
    			</point>
    			<point>
    				<intensity>93</intensity>
    				<time>570</time>
    			</point>
    			<point>
    				<intensity>79</intensity>
    				<time>580</time>
    			</point>
    			<point>
    				<intensity>112</intensity>
    				<time>590</time>
    			</point>
    			<point>
    				<intensity>102</intensity>
    				<time>600</time>
    			</point>
    			<point>
    				<intensity>70</intensity>
    				<time>610</time>
    			</point>
    			<point>
    				<intensity>56</intensity>
    				<time>620</time>
    			</point>
    			<point>
    				<intensity>56</intensity>
    				<time>630</time>
    			</point>
    			<point>
    				<intensity>37</intensity>
    				<time>640</time>
    			</point>
    			<point>
    				<intensity>41</intensity>
    				<time>650</time>
    			</point>
    			<point>
    				<intensity>40</intensity>
    				<time>660</time>
    			</point>
    			<point>
    				<intensity>39</intensity>
    				<time>670</time>
    			</point>
    			<point>
    				<intensity>38</intensity>
    				<time>680</time>
    			</point>
    			<point>
    				<intensity>37</intensity>
    				<time>690</time>
    			</point>
    			<point>
    				<intensity>36</intensity>
    				<time>700</time>
    			</point>
    			<point>
    				<intensity>35</intensity>
    				<time>710</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>720</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>730</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>740</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>750</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>760</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>770</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>780</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>790</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>800</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>810</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>820</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>830</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>840</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>850</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>860</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>870</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>880</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>910</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>930</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>950</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>970</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1020</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1110</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1130</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1140</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1150</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1160</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1170</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1180</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1190</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1220</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1270</time>
    			</point>
    			<point>
    				<intensity>0</intensity>
    				<time>1290</time>
    			</point>
    		</cool_white>
    		
    	</colors>
    </ramp>

  5. #5
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,588

    Re: Help with XML to datagridview

    Can you show how the xml data is mapped to the columns and/or rows?

  6. #6
    Join Date
    Apr 2017
    Posts
    7

    Re: Help with XML to datagridview

    Quote Originally Posted by Arjay View Post
    Can you show how the xml data is mapped to the columns and/or rows?
    it's in the previous reply (Screen shot of datagridview)

  7. #7
    Join Date
    Apr 2017
    Posts
    7

    Re: Help with XML to datagridview

    issue is that all numbers for each color should start in row 1

  8. #8
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,588

    Re: Help with XML to datagridview

    Quote Originally Posted by cjonline View Post
    issue is that all numbers for each color should start in row 1
    I'm trying to help but if you don't answer my questions, I have to try to guess what you are looking for and then if I get it wrong I have to spend more time answering again. So let's eliminate me having to waste time by you simply answering my last question. Okay?

    So again...
    >> Can you show how the xml data is mapped to the columns and/or rows?

  9. #9
    Join Date
    Apr 2017
    Posts
    7

    Re: Help with XML to datagridview

    Quote Originally Posted by Arjay View Post
    I'm trying to help but if you don't answer my questions, I have to try to guess what you are looking for and then if I get it wrong I have to spend more time answering again. So let's eliminate me having to waste time by you simply answering my last question. Okay?

    So again...
    >> Can you show how the xml data is mapped to the columns and/or rows?
    sorry, I'm not been difficult I just dont understand what you are looking for.

    so,
    table should be as follows -

    Color from xml (ie deep_red) will be the data grid column name.
    Intensity (ie 0) for each colour will be represented in each row based on Time.


    deep_red blue uv cool_white
    0 0 0 0
    20 0 10 0
    30 0 20 10

    does that help? sorry, I cant format a table correctly in the reply.

    the

  10. #10
    Join Date
    Apr 2017
    Posts
    7

    Re: Help with XML to datagridview

    bump

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)