I am trying create a tree view and have a nested while loop to get child nodes in vb.net.But for some reason it even if it is levels down it only displays the value in the third level(I want to have 5 level&#039;s.Please help very urgent.I appreciate your help <BR>My code<BR> Private Sub FillTreeView(ByVal TreeName As TreeView)<BR> Dim TreeClass As TreeNode<BR> Dim TreeNode1 As TreeNode<BR> Dim TreeDetail1 As TreeNode<BR> Dim TreeDetail2 As TreeNode<BR> Dim TreeDetail3 As TreeNode<BR> Dim TreeDetail4 As TreeNode<BR> Dim TreeDetail5 As TreeNode<BR> Dim TreeDetail6 As TreeNode<BR> Dim TreeDetail7 As TreeNode<BR> Dim TreeDetail8 As TreeNode<BR> Dim TreeDetail9 As TreeNode<BR> Dim TreeDetail10 As TreeNode<BR> Dim sqlClass As String<BR> Dim sql As String<BR> Dim sqldetail1 As String<BR> Dim sqldetail2 As String<BR> Dim sqldetail3 As String<BR> Dim sqldetail4 As String<BR> Dim sqldetail5 As String<BR> Dim sqldetail6 As String<BR> Dim sqldetail7 As String<BR> Dim sqldetail8 As String<BR> Dim sqldetail9 As String<BR> Dim sqldetail10 As String<BR> Dim sqlcommandclass As New SqlClient.SqlCommand<BR> Dim sqlcommand As New SqlClient.SqlCommand<BR> Dim sqlcommanddetail1 As New SqlClient.SqlCommand<BR> Dim sqlcommanddetail2 As New SqlClient.SqlCommand<BR> Dim sqlcommanddetail3 As New SqlClient.SqlCommand<BR> Dim sqlcommanddetail4 As New SqlClient.SqlCommand<BR> Dim sqlcommanddetail5 As New SqlClient.SqlCommand<BR> Dim sqlcommanddetail6 As New SqlClient.SqlCommand<BR> Dim sqlcommanddetail7 As New SqlClient.SqlCommand<BR> Dim sqlcommanddetail8 As New SqlClient.SqlCommand<BR> Dim sqlcommanddetail9 As New SqlClient.SqlCommand<BR> Dim sqlcommanddetail10 As New SqlClient.SqlCommand<BR><BR> Dim readerclass As SqlClient.SqlDataReader<BR> Dim reader As SqlClient.SqlDataReader<BR> Dim readerdetail1 As SqlClient.SqlDataReader<BR> Dim readerdetail2 As SqlClient.SqlDataReader<BR> Dim readerdetail3 As SqlClient.SqlDataReader<BR> Dim readerdetail4 As SqlClient.SqlDataReader<BR> Dim readerdetail5 As SqlClient.SqlDataReader<BR> Dim readerdetail6 As SqlClient.SqlDataReader<BR> Dim readerdetail7 As SqlClient.SqlDataReader<BR> Dim readerdetail8 As SqlClient.SqlDataReader<BR> Dim readerdetail9 As SqlClient.SqlDataReader<BR> Dim readerdetail10 As SqlClient.SqlDataReader<BR> Cursor.Current = System.Windows.Forms.Cursors.WaitCursor<BR><BR> TreeName.BeginUpdate()<BR> TreeName.Nodes.Clear()<BR><BR> sqlClass = "select * from Documenttype where parentnode =&#039;0&#039;"<BR><BR> sqlcommandclass = New SqlClient.SqlCommand(sqlClass, Module1.Conn())<BR> readerclass = sqlcommandclass.ExecuteReader()<BR><BR> While readerclass.Read()<BR> TreeClass = TreeName.Nodes.Add(Trim(readerclass("Name")))<BR> TreeClass.Tag = readerclass("node")<BR><BR> sql = "select * from Documenttype where parentnode=" & readerclass("node")<BR> sqlcommand = New SqlClient.SqlCommand(sql, Module1.Conn())<BR> reader = sqlcommand.ExecuteReader()<BR><BR> While reader.Read()<BR> TreeNode1 = TreeClass.Nodes.Add(Trim(reader("Name")))<BR> TreeNode1.Tag = reader("node")<BR> sqldetail1 = "select * from Documenttype where parentnode=" & reader("node")<BR> sqlcommanddetail1 = New SqlClient.SqlCommand(sqldetail1, Module1.Conn())<BR> readerdetail1 = sqlcommanddetail1.ExecuteReader()<BR> While readerdetail1.Read()<BR> TreeDetail1 = TreeNode1.Nodes.Add(Trim(readerdetail1("Name")))<B R> TreeDetail1.Tag = readerdetail1("node")<BR> sqldetail2 = "select * from Documenttype where parentnode=" & readerdetail1("node")<BR> sqlcommanddetail2 = New SqlClient.SqlCommand(sqldetail2, Module1.Conn())<BR> readerdetail2 = sqlcommanddetail2.ExecuteReader()<BR> While readerdetail2.Read()<BR> TreeDetail2 = TreeNode1.Nodes.Add(Trim(readerdetail2("Name")))<B R> TreeDetail2.Tag = readerdetail2("node")<BR> sqldetail3 = "select * from Documenttype where parentnode=" & readerdetail2("node")<BR> sqlcommanddetail3 = New SqlClient.SqlCommand(sqldetail3, Module1.Conn())<BR> readerdetail3 = sqlcommanddetail3.ExecuteReader()<BR> While readerdetail3.Read()<BR> TreeDetail3 = TreeNode1.Nodes.Add(Trim(readerdetail3("Name")))<B R> TreeDetail3.Tag = readerdetail3("node")<BR> sqldetail4 = "select * from Documenttype where parentnode=" & readerdetail3("node")<BR> sqlcommanddetail4 = New SqlClient.SqlCommand(sqldetail4, Module1.Conn())<BR> readerdetail4 = sqlcommanddetail4.ExecuteReader()<BR> While readerdetail4.Read()<BR> TreeDetail4 = TreeNode1.Nodes.Add(Trim(readerdetail4("Name")))<B R> TreeDetail4.Tag = readerdetail4("node")<BR> sqldetail5 = "select * from Documenttype where parentnode=" & readerdetail4("node")<BR> sqlcommanddetail5 = New SqlClient.SqlCommand(sqldetail5, Module1.Conn())<BR> readerdetail5 = sqlcommanddetail5.ExecuteReader()<BR> While readerdetail5.Read()<BR> TreeDetail5 = TreeNode1.Nodes.Add(Trim(readerdetail5("Name")))<B R> TreeDetail5.Tag = readerdetail5("node")<BR> End While<BR> readerdetail5.Close()<BR> TreeDetail5 = Nothing<BR> End While<BR> readerdetail4.Close()<BR> TreeDetail4 = Nothing<BR> End While<BR> readerdetail3.Close()<BR> TreeDetail3 = Nothing<BR> End While<BR> readerdetail2.Close()<BR> TreeDetail2 = Nothing<BR> End While<BR> readerdetail1.Close()<BR> TreeDetail1 = Nothing<BR> End While<BR> reader.Close()<BR> TreeClass = Nothing<BR> End While<BR><BR> TreeName.ExpandAll()<BR><BR> Cursor.Current = System.Windows.Forms.Cursors.Default<BR> TreeName.EndUpdate()<BR><BR> Module1.Conn.Close()<BR><BR> End Sub<BR>