TreeView-Error
-
Here I am trying to fill the tree view category and subcategory wise..see the below |Benson and Hedges |Kings Gold Falke Beverages | |-Beers | |-Bell Lager 500 ML | |-CLUB PILSENER 500 ML | |-Juices | |-Apple Juice | |-Chikooo Juice |-Food | |-MeatProducts | |-GOAT MEAT | |-Fruits | |-APPLE GREEN | |-LOCAL ORANGES |-VegeTable | | |-BEETROOT | |-TOMATO FRESH I have tried the following code..but I am able to fill only one product under one sub category. Please help me out how to??initialize and fill the data into tree view
foreach (DataRow row in table.Rows)
{
MainNode = new TreeNode(row.ItemArray[0].ToString());
MainNode.Name = row.ItemArray[0].ToString();
if (MainNode.Text == "")
{
//Stmts
}else { ChildNode = new TreeNode(row.ItemArray\[1\].ToString()); ChildNode.Name = row.ItemArray\[1\].ToString(); if (ChildNode.Text == "") { ChildNode = new TreeNode(row.ItemArray\[3\].ToString()); ChildNode.Name = row.ItemArray\[3\].ToString(); ChildNode.Tag = row.ItemArray\[2\].ToString(); if (!MainNode.Nodes.ContainsKey(ChildNode.Name)) { MainNode.Nodes.Add(ChildNode); } } else { SubNode = new TreeNode(row.ItemArray\[3\].ToString()); SubNode.Name = row.ItemArray\[3\].ToString(); SubNode.Tag = row.ItemArray\[2\].ToString(); if (!ChildNode.Nodes.ContainsKey(SubNode.Name)) { ChildNode.Nodes.Add(SubNode); } } if (!MainNode.Nodes.ContainsKey(ChildNode.Name)) { MainNode.Nodes.Add(ChildNode); } else {
//Here I am unable to understand how to fill child nodes into mainnode
//The below code is wrong
for (int i = 0; i <= MainNode.Nodes.Count; i++)
{ -
Here I am trying to fill the tree view category and subcategory wise..see the below |Benson and Hedges |Kings Gold Falke Beverages | |-Beers | |-Bell Lager 500 ML | |-CLUB PILSENER 500 ML | |-Juices | |-Apple Juice | |-Chikooo Juice |-Food | |-MeatProducts | |-GOAT MEAT | |-Fruits | |-APPLE GREEN | |-LOCAL ORANGES |-VegeTable | | |-BEETROOT | |-TOMATO FRESH I have tried the following code..but I am able to fill only one product under one sub category. Please help me out how to??initialize and fill the data into tree view
foreach (DataRow row in table.Rows)
{
MainNode = new TreeNode(row.ItemArray[0].ToString());
MainNode.Name = row.ItemArray[0].ToString();
if (MainNode.Text == "")
{
//Stmts
}else { ChildNode = new TreeNode(row.ItemArray\[1\].ToString()); ChildNode.Name = row.ItemArray\[1\].ToString(); if (ChildNode.Text == "") { ChildNode = new TreeNode(row.ItemArray\[3\].ToString()); ChildNode.Name = row.ItemArray\[3\].ToString(); ChildNode.Tag = row.ItemArray\[2\].ToString(); if (!MainNode.Nodes.ContainsKey(ChildNode.Name)) { MainNode.Nodes.Add(ChildNode); } } else { SubNode = new TreeNode(row.ItemArray\[3\].ToString()); SubNode.Name = row.ItemArray\[3\].ToString(); SubNode.Tag = row.ItemArray\[2\].ToString(); if (!ChildNode.Nodes.ContainsKey(SubNode.Name)) { ChildNode.Nodes.Add(SubNode); } } if (!MainNode.Nodes.ContainsKey(ChildNode.Name)) { MainNode.Nodes.Add(ChildNode); } else {
//Here I am unable to understand how to fill child nodes into mainnode
//The below code is wrong
for (int i = 0; i <= MainNode.Nodes.Count; i++)
{Problem is
for (int i = 0; i <= MainNode.Nodes.Count; i++)
{ MainNode.Nodes.Add(ChildNode);
}why this loop...you should learn about recursive methods ;)
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can
-
Problem is
for (int i = 0; i <= MainNode.Nodes.Count; i++)
{ MainNode.Nodes.Add(ChildNode);
}why this loop...you should learn about recursive methods ;)
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can
-
Recursive methods?? Please help me out with an example or an article..I have never worked on it??
Link using stack http://www.google.com/search?hl=en&client=opera&rls=en&hs=D58&q=Recursive+methods+in+C%23&btnG=Search[^]
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can