Im using

For Each foundFile As String In My.Computer.FileSystem.GetFiles( _
    My.Computer.FileSystem.SpecialDirectories.MyDocuments, _
    FileIO.SearchOption.SearchAllSubDirectories, "*element.txt")

            ListBox1.Items.Add(foundFile)

to get file paths. There are 3 elements for example. And i need them to become variables. (a,b,c)
And show in labels

Label1.text= a
Label2.Text =b
Label3.Text =c

Label1 will show the first file path and so on...

How can i transfer FilePaths to variables?

ListBox1.SetSelected(0, True)
        Label1.Text = ListBox1.SelectedItem.ToString
        ListBox1.SetSelected(1, True)
        Label2.Text = ListBox1.SelectedItem.ToString
        ListBox1.SetSelected(2, True)
        Label3.Text = ListBox1.SelectedItem.ToString

u queried & u solved... :)

Elaborate more on what you mean by 3 elements in a filepath

to get file paths. There are 3 elements for example. And i need them to become variables. (a,b,c)
And show in labels

Label1.text= a
Label2.Text =b
Label3.Text =c

Label1 will show the first file path and so on...

How can i transfer FilePaths to variables?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.