Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Treeview problem

Posted on 2009-07-09
1
Medium Priority
?
181 Views
Last Modified: 2012-05-07
I am having some troble.

I can get a treeview with A, B, C.......Z
Here under each of the letters I want my Contacts Last name get under correct Letter.
For example Andersson should be under A

I have managed to do a search for the contact and getting a list back with all that includes for example A.

My problem is I want it into the treeview. How do I do that?

A
   Andersson
   Andersen
    Albertsson

B
   Bengtsson
    Berntsson

and so on

Please advice me......some code would be great
private void button1_Click(object sender, EventArgs e)
        {
            Contact cust = new Contact();
            cust.FirstName = textBox1.Text;
            cust.LastName = textBox1.Text;
            contactManager.Contacts.Add(cust);
 
 
 
            listView1.Items.Add(contactManager.Contacts[0].FirstName);
            List<Contact> searchList = new List<Contact>();
 
            //Supress repainting
            treeView1.BeginUpdate();
 
            char outstr = ('A');
            
            TreeNode node;
            for (int i = 1; i < 27; i++)
            {
                node = treeView1.Nodes.Add(Convert.ToString(outstr));
                searchList = contactManager.FindALetterSearch(outstr);
                outstr +=  (char)(+1);
            }
            //resume repainting
            treeView1.EndUpdate();
        }

Open in new window

0
Comment
Question by:Mickeys
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 2000 total points
ID: 24820585

private void button1_Click(object sender, EventArgs e)
        {
            Contact cust = new Contact();
            cust.FirstName = textBox1.Text;
            cust.LastName = textBox1.Text;
            contactManager.Contacts.Add(cust);
 
 
 
            listView1.Items.Add(contactManager.Contacts[0].FirstName);
            List<Contact> searchList = new List<Contact>();
 
            //Supress repainting
            treeView1.BeginUpdate();
 
            char outstr = ('A');
            
            TreeNode node;
            for (int i = 1; i < 27; i++)
            {
                node = treeView1.Nodes.Add(Convert.ToString(outstr));
                searchList = contactManager.FindALetterSearch(outstr);
                for(int k=0;k<searchList.Count;k++)
                {
                     node.Nodes.Add(searchList[k].FirstName);
                }
                outstr +=  (char)(+1);
            }
            //resume repainting
            treeView1.EndUpdate();
        }

Open in new window

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question