---
title: "How to work with Nested ArrayLists in VB"  
description: "How to work with Nested ArrayLists in VB"  
author: "Pravesh Singh"  
published: 2013-06-11  
updated: 2013-06-12  
canonical: https://www.mindstick.com/forum/1026/how-to-work-with-nested-arraylists-in-vb  
category: "vb.net"  
tags: ["vb.net"]  
reading_time: 1 minute  

---

# How to work with Nested ArrayLists in VB

Hi Everyone,\
I'm try to work with [Nested](https://www.mindstick.com/forum/45/itemcommand-event-in-nested-repeater-and-listview) [ArrayList](https://www.mindstick.com/articles/11973/arraylist-class-in-c-sharp) in VB.Net. Where i'm [wrong](https://answers.mindstick.com/qa/48468/who-wrote-the-the-wrong-enemy-america-in-afghanistan-2001-2014-and-when)? Is there a better way of doing it? For some reason my [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) passes [right](https://www.mindstick.com/articles/12766/check-whether-you-are-doing-digital-transformation-right-or-not) through the [printing](https://www.mindstick.com/blog/63804/5-ways-you-can-use-printing-in-your-marketing-strategy) code without outputting anything at all. \
**My line of code as following**\

```
    Dim k As New List(Of String)    Dim a As New List(Of List(Of String))       For fc = 1 To 2          k.add("hi")          k.add("hey")          k.add("bye")          a.add(k)          k.clear()
```

\
########Printing [Stuff](https://www.mindstick.com/interview/33816/what-is-stuff-function-is-sql-server)\

```
    Dim i As Integer    For i = 0 To a.Count - 1        Dim sstr As String        For Each sstr In a.Item(i)            MsgBox(sstr)        Next    Next i
```

\
Any help would be amazing thank you!\
\

## Replies

### Reply by AVADHESH PATEL

Hi Pravesh,\
In place of **k.clear** try **k = new List(Of String)** in each loop. \
I hope it resolve your problem. \


---

Original Source: https://www.mindstick.com/forum/1026/how-to-work-with-nested-arraylists-in-vb

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
