lets say im dragging a bunch of files to my list view controll..
how can i filter those files, in a way that when i drop them, i will get only mp3 files
and the rest of the files that i dropped would not show up

Try checking the filename extension before adding it and only add the ones that end with ".mp3". Here's the full code:

private void listview1_DragEnter(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
                e.Effect = DragDropEffects.Copy;
        }

private void listview1_DragDrop(object sender, DragEventArgs e)
        {
            string[] directoryName = (string[])e.Data.GetData(DataFormats.FileDrop);

            //Get all the files inside that folder
            string[] files = Directory.GetFiles(directoryName[0]);

            listview1.Items.Clear();

            foreach (string file in files)
            {
                if (Path.GetExtension(file) == ".mp3")
                    listview1.Items.Add(file);
            }
        }

Hope it helps!

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.