Hello guys! Its been a very long time since I don't show up here.

Now I am back with a small project for internal use, but I need a little help.
I want to make a program that allows me to change file attributes, like 'hidden', 'read-only' and 'system'.

It seems pretty simple, but I want that multiple files can be modified at once. For this I would need a list that shows the files into the interface. There is what I can't get.

I first thought on a listbox, but there is also a listview which seems much more complete, but I just don't know how to use it. I was wondering if I could make something like: I open a folder, all the items inside that folder would be listed inside the listview.

Can someone help me?

More info:
I learned a bit, but not enough. I've set the listview to 'details' mode, so I can actually list items. Also, I've added three collums: one for file name, other for file size and another for file attributes. I just need to learn now how they works.

I've changed lots of things here.
First, I decided to use the listbox control, instead of the listview.
Second, part of the needed logic is ready, but it only works for one selected item. I'm not home now, so I don't have a way to access the code, but, there is some way to make the checks avaliable for multiple files?

I'll post the code later, and explain it a little better.

This is my code:

Imports System.IO
Public Class Form1
    Dim Pasta As String
    Private Sub btnProcuraPasta_Click(sender As System.Object, e As System.EventArgs) Handles btnProcuraPasta.Click
        If ProcuraPasta.ShowDialog = Windows.Forms.DialogResult.OK Then
            Pasta = ProcuraPasta.SelectedPath
            Caminho.Text = Pasta
        End If
        If Pasta <> "" Then
                For Each myCoolFile As String In My.Computer.FileSystem.GetFiles(Pasta, FileIO.SearchOption.SearchTopLevelOnly, "*.*")
                    'ListBox1.Items.Add(IO.Path.GetFileName(myCoolFile)) '// add only File Name with extension.
                    ListaArquivos.Items.Add(myCoolFile) '// add File with FullPath.
            Catch ex As UnauthorizedAccessException
            End Try
        End If
    End Sub

    Private Sub MudaTexto(sender As System.Object, e As System.EventArgs) Handles ListaArquivos.SelectedIndexChanged
        Dim Atributos As FileAttributes
        Dim Data As String
        If ListaArquivos.SelectedItem = "" Then
            Atributos = File.GetAttributes(ListaArquivos.SelectedItem)
            Data = File.GetLastAccessTime(ListaArquivos.SelectedItem)

            dataUltimoAcesso.Text = Data
        End If
        If (Atributos And FileAttributes.Hidden) = FileAttributes.Hidden Then
            ArqOculto.CheckState = CheckState.Checked
            ArqOculto.CheckState = CheckState.Unchecked
        End If
        If (Atributos And FileAttributes.System) = FileAttributes.System Then
            ArqSistema.CheckState = CheckState.Checked
            ArqSistema.CheckState = CheckState.Unchecked
        End If
        If (Atributos And FileAttributes.ReadOnly) = FileAttributes.ReadOnly Then
            ArqLeitura.CheckState = CheckState.Checked
            ArqLeitura.CheckState = CheckState.Unchecked
        End If
    End Sub
End Class

It works for only one file. I want that it works for multiple selected items.
Also, I need to change the file attributes (for all selected files) and apply them later. There is a process button on the form.

How can I do it? '-'

Please forget this since I've changed almost everything.

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.