Click here to Skip to main content
15,892,674 members
Home / Discussions / C#
   

C#

 
AnswerRe: Threads issue Pin
Nicholas Butler18-Feb-10 0:25
sitebuilderNicholas Butler18-Feb-10 0:25 
QuestionRe: Threads issue Pin
harold aptroot18-Feb-10 0:48
harold aptroot18-Feb-10 0:48 
AnswerRe: Threads issue Pin
David Skelly18-Feb-10 3:03
David Skelly18-Feb-10 3:03 
AnswerRe: Threads issue Pin
HideIvy18-Feb-10 22:28
HideIvy18-Feb-10 22:28 
Questiontreenodecollection nodes not working as expected with created class [SOLVED] Pin
tonyonlinux17-Feb-10 20:07
tonyonlinux17-Feb-10 20:07 
AnswerRe: treenodecollection nodes not working as expected with created class Pin
Dan Mos17-Feb-10 20:28
Dan Mos17-Feb-10 20:28 
GeneralRe: treenodecollection nodes not working as expected with created class [SOLVED] Pin
tonyonlinux18-Feb-10 1:07
tonyonlinux18-Feb-10 1:07 
GeneralRe: treenodecollection nodes not working as expected with created class Pin
tonyonlinux18-Feb-10 1:31
tonyonlinux18-Feb-10 1:31 
here is what I have
private void Filter_combo_SelectedIndexChanged(object sender, EventArgs e)
       {
           /* Populate the tree based on whatever the user selects to filter by
            * for example if they click on keywords then only show the keywords
            */

           string filter = Filter_combo.Text;





           using (var db = new mombooksDataContext(Properties.Settings.Default.BooksConnectionString2))
           {

               TreeNodeCollection[] nodes = new TreeNodeCollection[treeView1.Nodes.Count];
               treeView1.Nodes.CopyTo(nodes, 0);
               treeView1.Nodes.Clear();//get rid of this BEFORE we're done.
               treeView1.Nodes.AddRange(NodeBuilder.BuildNodes(nodes, db.Authors, db.Books, filter));

           }
       }


class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using momdb;

namespace Utilties
{
    public sealed class NodeBuilder
    {
       // public static void BuildNodes(TreeNodeCollection nodes,IEnumerable<Author>authors, IEnumerable<Book> books, string filter)
          public static TreeNode[] BuildNodes(TreeNodeCollection nodes,IEnumerable<Author>authors, IEnumerable<Book> books, string filter)
       {
            TreeNode[] holder;
              
            if (filter == "Keywords" || filter == "Title")
            {
                
                filter = string.Format("m.{0}", filter);
                books.ToList().ForEach(m =>
                    {
                        TreeNode node = new TreeNode(filter);
                        node.Tag = m;
                        nodes.Add(node);
                        
                    });
               
            }
           if (filter =="Author")
           {
               authors.ToList().ForEach(m =>
                {
                TreeNode node =new TreeNode(filter); 
                node.Tag=m;
                nodes.Add(node);
                 }); 
           }
           return holder = new TreeNode[nodes.Count];
        }
      
    }
}

GeneralRe: treenodecollection nodes not working as expected with created class Pin
Dan Mos18-Feb-10 2:40
Dan Mos18-Feb-10 2:40 
GeneralRe: treenodecollection nodes not working as expected with created class Pin
tonyonlinux18-Feb-10 6:43
tonyonlinux18-Feb-10 6:43 
GeneralRe: treenodecollection nodes not working as expected with created class Pin
Dan Mos18-Feb-10 10:03
Dan Mos18-Feb-10 10:03 
GeneralRe: treenodecollection nodes not working as expected with created class Pin
tonyonlinux18-Feb-10 13:18
tonyonlinux18-Feb-10 13:18 
GeneralRe: treenodecollection nodes not working as expected with created class Pin
Dan Mos18-Feb-10 13:34
Dan Mos18-Feb-10 13:34 
GeneralRe: treenodecollection nodes not working as expected with created class Pin
tonyonlinux19-Feb-10 17:00
tonyonlinux19-Feb-10 17:00 
QuestionHow to set a property in a collection based on the join? Pin
sri_346417-Feb-10 20:04
sri_346417-Feb-10 20:04 
AnswerRe: How to set a property in a collection based on the join? Pin
Dan Mos17-Feb-10 20:36
Dan Mos17-Feb-10 20:36 
QuestionSaving Data on a Form Pin
thomas_anderson17-Feb-10 18:00
thomas_anderson17-Feb-10 18:00 
AnswerRe: Saving Data on a Form Pin
AspDotNetDev17-Feb-10 18:33
protectorAspDotNetDev17-Feb-10 18:33 
GeneralRe: Saving Data on a Form Pin
thomas_anderson17-Feb-10 20:23
thomas_anderson17-Feb-10 20:23 
GeneralRe: Saving Data on a Form Pin
Richard MacCutchan17-Feb-10 21:46
mveRichard MacCutchan17-Feb-10 21:46 
GeneralRe: Saving Data on a Form Pin
thomas_anderson20-Feb-10 11:28
thomas_anderson20-Feb-10 11:28 
GeneralRe: Saving Data on a Form Pin
AspDotNetDev17-Feb-10 21:47
protectorAspDotNetDev17-Feb-10 21:47 
GeneralRe: Saving Data on a Form Pin
thomas_anderson20-Feb-10 11:29
thomas_anderson20-Feb-10 11:29 
QuestionReading from parallel port using c# Pin
A k ch17-Feb-10 17:41
A k ch17-Feb-10 17:41 
Questionplease forgive me for i know this is basic but i simply don't know how to add stuff a list like this Pin
tonyonlinux17-Feb-10 15:20
tonyonlinux17-Feb-10 15:20 

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.