Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Datagridview

$
0
0
Good day, I am developing a music player, just that I am having a problem inserting data into datagrid, as I am trying to put the names of the music in a column called "name" and address the same, in a column called "Location".

Nome  | Local

Musica1  | C:\....

Musica2  | C:\....

Musica3  | C:\....

Only I had to use the For Each to put the name of all the songs in the table, only have to do it with the address of music.

            Dim nome, local As String

            For Each nome In OpenFileDialog1.SafeFileNames
                DataGridView1.Rows.Add(nome)

            Next

            For Each local In OpenFileDialog1.FileNames
                DataGridView1.Rows.Add(local)

            Next

Only I had to use the For Each to put the name of all the songs in the table, only have to do it with the address of music.

           
            Dim nome, local As String

            For Each nome In OpenFileDialog1.SafeFileNames
            For Each local In OpenFileDialog1.FileNames
                DataGridView1.Rows.Add(nome, local)

            Next


            Next

And would like to know if you have any solution for this or an easier way for me to solve this problem, because it would add more than one song. And he failed to add the name of all without the For Each.

Viewing all articles
Browse latest Browse all 12583

Trending Articles