GET THE NAME AND PATH OF A DRIVE'S FOLDERS - VISUAL BASIC

José Carlos 886 Reputation points
2023-06-25T17:29:47.1833333+00:00

Friends.

I have a C++ Winforms program that has the snippet below. I need this snippet in Visual Basic. I've already made a few attempts, but I don't know the meaning of the word auto. How to pass this snippet to Visual Basic?

			//GET THE NAME OF A DRIVE'S FOLDER
			auto pastas = Directory::GetDirectories("D:\\");

			for each (String ^ dir in pastas)
			{
				listBox1->Items->Add(dir);
			}
			label4->Text = listBox1->Items->Count.ToString();
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,375 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,768 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 86,501 Reputation points
    2023-06-25T18:28:51.7366667+00:00

    For example :

    
                Dim pastas = Directory.GetDirectories("D:\\")
                For Each directory In pastas
                    ' code...
                Next
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.