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
        ListaArquivos.Items.Clear()
        If ProcuraPasta.ShowDialog = Windows.Forms.DialogResult.OK Then
            Pasta = ProcuraPasta.SelectedPath
            Caminho.Text = Pasta
        End If
        If Pasta <> "" Then
            Try
                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.
                Next
            Catch ex As UnauthorizedAccessException
                MsgBox(ex.Message)
            End Try
        Else
        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
        Else
            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
        Else
            ArqOculto.CheckState = CheckState.Unchecked
        End If
        If (Atributos And FileAttributes.System) = FileAttributes.System Then
            ArqSistema.CheckState = CheckState.Checked
        Else
            ArqSistema.CheckState = CheckState.Unchecked
        End If
        If (Atributos And FileAttributes.ReadOnly) = FileAttributes.ReadOnly Then
            ArqLeitura.CheckState = CheckState.Checked
        Else
            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.