1、For Each…Next 循环语句,控制流程介绍示例代码如下:
2、Private Sub btnForEachLoop_Click(sender As Object, e As EventArgs) Handles btnForEachLoop.Click 'Clear the list ClearList() 'List each folder at the root of your C drive For Each strFolder As String In My.Computer.FileSystem.GetDirectories("C:\") 'Add the item to the list lstData.Items.Add(strFolder) NextEnd Sub