Click here to Skip to main content
15,897,273 members
Home / Discussions / C#
   

C#

 
AnswerRe: Need help with crystal reports in VS 2008 Pin
Richard Andrew x6410-Jun-10 17:29
professionalRichard Andrew x6410-Jun-10 17:29 
GeneralRe: Need help with crystal reports in VS 2008 Pin
eduardods10-Jun-10 17:56
eduardods10-Jun-10 17:56 
GeneralRe: Need help with crystal reports in VS 2008 Pin
Richard Andrew x6410-Jun-10 18:17
professionalRichard Andrew x6410-Jun-10 18:17 
GeneralRe: Need help with crystal reports in VS 2008 Pin
eduardods10-Jun-10 20:02
eduardods10-Jun-10 20:02 
AnswerRe: Need help with crystal reports in VS 2008 Pin
V.10-Jun-10 21:11
professionalV.10-Jun-10 21:11 
AnswerRe: Need help with crystal reports in VS 2008 Pin
Mycroft Holmes11-Jun-10 22:04
professionalMycroft Holmes11-Jun-10 22:04 
QuestionHow to add images to a reportviewer ??? Pin
isaacrc8210-Jun-10 13:33
isaacrc8210-Jun-10 13:33 
Questionpopulating a treeview? Pin
User 251249410-Jun-10 6:05
User 251249410-Jun-10 6:05 
I'm trying to build a treeview of 4 layers, using 4 tables in the database.

Layer 1: Departments
Layer 2: Groups
Layer 3: Products
Layer 4: Barcodes

No I've had a go at getting the 4 tables in as a dataset, and tried to populate the treeview, but only the first 2 layers will show up in my tree view.

If I make layer 2 my first layer, only layer 2 and 3 will show up.

<br />
private void Load_tree()<br />
      {<br />
         DataSet ds = new DataSet();<br />
         SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CCS_HOConnectionString"].ConnectionString);<br />
         SqlDataAdapter daDepts = new SqlDataAdapter("barcodePrinter_get_Departments", conn);<br />
         SqlDataAdapter daGroups = new SqlDataAdapter("barcodePrinter_get_Groups", conn);<br />
         SqlDataAdapter daProducts = new SqlDataAdapter("barcodePrinter_get_Products", conn);<br />
         SqlDataAdapter daBarcode = new SqlDataAdapter("barcodePrinter_get_Barcode", conn);<br />
<br />
<br />
         daDepts.Fill(ds, "DEPTS");<br />
         daGroups.Fill(ds, "PRODGRP");<br />
         daProducts.Fill(ds, "PRODUCT");<br />
         daBarcode.Fill(ds, "product_barcode");<br />
<br />
<br />
         ds.Relations.Add("Depts_Group", ds.Tables["DEPTS"].Columns["DEPTCODE"], ds.Tables["PRODGRP"].Columns["PGRPDEPT"]);<br />
         ds.Relations.Add("Group_Product", ds.Tables["PRODGRP"].Columns["PGRPID"], ds.Tables["PRODUCT"].Columns["PRODGRP"]);<br />
         ds.Relations.Add("ProdBarcode", ds.Tables["PRODUCT"].Columns["PRODCODE"], ds.Tables["product_barcode"].Columns["prodcode"]);<br />
<br />
         dataGridView1.DataSource = ds.Tables["DEPTS"];<br />
         dataGridView2.DataSource = ds.Tables["PRODGRP"];<br />
         dataGridView3.DataSource = ds.Tables["PRODUCT"];<br />
         dataGridView4.DataSource = ds.Tables["product_barcode"];<br />
<br />
         foreach (DataRow dr in ds.Tables["DEPTS"].Rows)<br />
         {<br />
            TreeNode tn = new TreeNode(dr["DEPTSHORT"].ToString());<br />
            foreach (DataRow drGroup in dr.GetChildRows("Depts_Group"))<br />
            {<br />
               TreeNode tnn = new TreeNode(drGroup["PGRPSHORT"].ToString());<br />
               foreach (DataRow drProduct in dr.GetChildRows("Group_Product"))<br />
               {<br />
                  TreeNode tnnn = new TreeNode(drProduct["PRODSHORT"].ToString());<br />
                  foreach (DataRow drBarcode in dr.GetChildRows("Product_Barcode"))<br />
                  {<br />
                     tnnn.Nodes.Add(drBarcode["barcode"].ToString());<br />
                  }<br />
                  tnn.Nodes.Add(tnnn);<br />
               }<br />
               tn.Nodes.Add(tnn);<br />
            }<br />
            trvBarcodes.Nodes.Add(tn);<br />
         }<br />
         trvBarcodes.ExpandAll();<br />
       }<br />


I'm looking for a solution that will make all 4 layers show in the treeview.
Like
+Department 1
-+Group 1
--+Product 1
----Barcode 1
----Barcode 2
-+Group 2
--+Product 2
----Barcode 3
--+Product 3
----Barcode 4

I never know how many layers there will be within the child node, this is decided by the list in the database and that one can change.

modified 4-Nov-20 21:00pm.

AnswerRe: populating a treeview? Pin
Mycroft Holmes11-Jun-10 22:08
professionalMycroft Holmes11-Jun-10 22:08 
QuestionList<T> Comparison [SOLVED] Pin
Paladin200010-Jun-10 4:58
Paladin200010-Jun-10 4:58 
AnswerRe: List Comparison Pin
DaveyM6910-Jun-10 5:10
professionalDaveyM6910-Jun-10 5:10 
GeneralRe: List Comparison Pin
Paladin200010-Jun-10 5:28
Paladin200010-Jun-10 5:28 
GeneralRe: List Comparison Pin
Hristo-Bojilov10-Jun-10 5:52
Hristo-Bojilov10-Jun-10 5:52 
AnswerRe: List Comparison Pin
Luc Pattyn10-Jun-10 5:30
sitebuilderLuc Pattyn10-Jun-10 5:30 
GeneralRe: List Comparison Pin
Paladin200010-Jun-10 5:39
Paladin200010-Jun-10 5:39 
GeneralRe: List Comparison Pin
#realJSOP10-Jun-10 6:36
professional#realJSOP10-Jun-10 6:36 
AnswerRe: List Comparison Pin
Paladin200010-Jun-10 5:58
Paladin200010-Jun-10 5:58 
GeneralRe: List Comparison Pin
Paladin200010-Jun-10 6:06
Paladin200010-Jun-10 6:06 
GeneralRe: List Comparison Pin
Luc Pattyn10-Jun-10 6:06
sitebuilderLuc Pattyn10-Jun-10 6:06 
AnswerRe: List Comparison Pin
Kevin McFarlane10-Jun-10 10:45
Kevin McFarlane10-Jun-10 10:45 
QuestionGoogle Maps Pin
JohnUSA10-Jun-10 2:53
JohnUSA10-Jun-10 2:53 
AnswerMessage Closed Pin
10-Jun-10 3:06
stancrm10-Jun-10 3:06 
GeneralRe: Google Maps Pin
JohnUSA10-Jun-10 4:45
JohnUSA10-Jun-10 4:45 
AnswerRe: Google Maps Pin
Paladin200010-Jun-10 4:41
Paladin200010-Jun-10 4:41 
GeneralRe: Google Maps Pin
JohnUSA10-Jun-10 4:53
JohnUSA10-Jun-10 4:53 

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.