Link to home
Start Free TrialLog in
Avatar of Mickeys
MickeysFlag for Sweden

asked on

Treeview problem

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

ASKER CERTIFIED SOLUTION
Avatar of Gautham Janardhan
Gautham Janardhan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial