[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] PopulateTreeview()[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] indx [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Short[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] currentAlpha [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] sContactName [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2]indx = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2]currentAlpha = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2]sContactName = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2]rowCustomer = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'Populate Treeview Control[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]For[/COLOR][/SIZE][SIZE=2] indx = Asc([/SIZE][SIZE=2][COLOR=#800000]"A"[/COLOR][/SIZE][SIZE=2]) [/SIZE][SIZE=2][COLOR=#0000ff]To[/COLOR][/SIZE][SIZE=2] Asc([/SIZE][SIZE=2][COLOR=#800000]"Z"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2]currentAlpha = Chr(indx)[/SIZE]
[SIZE=2]TreeView1.Nodes.Add([/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] TreeNode(currentAlpha))[/SIZE]
[SIZE=2][COLOR=#008000]' Add a child TreeNode for each Author in the matching Main Node. [/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]For[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Each[/COLOR][/SIZE][SIZE=2] rowCustomer [/SIZE][SIZE=2][COLOR=#0000ff]In[/COLOR][/SIZE][SIZE=2] dt.Rows[/SIZE]
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] (UCase(Mid(rowCustomer.Item([/SIZE][SIZE=2][COLOR=#800000]"LastName1"[/COLOR][/SIZE][SIZE=2]), 1, 1)) = currentAlpha) [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2]sContactName = rowCustomer.Item([/SIZE][SIZE=2][COLOR=#800000]"LastName1"[/COLOR][/SIZE][SIZE=2]) & [/SIZE][SIZE=2][COLOR=#800000]", "[/COLOR][/SIZE][SIZE=2] & rowCustomer.Item([/SIZE][SIZE=2][COLOR=#800000]"FirstName1"[/COLOR][/SIZE][SIZE=2]) & [/SIZE][SIZE=2][COLOR=#800000]" "[/COLOR][/SIZE][SIZE=2] & rowCustomer.Item([/SIZE][SIZE=2][COLOR=#800000]"MiddleInitial1"[/COLOR][/SIZE][SIZE=2]) & [/SIZE][SIZE=2][COLOR=#800000]"."[/COLOR][/SIZE]
[SIZE=2]TreeView1.Nodes(indx - 65).Nodes.Add(sContactName).Tag = rowCustomer.Item([/SIZE][SIZE=2][COLOR=#800000]"ContactID"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Next[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Next[/COLOR][/SIZE]