Quote Originally Posted by bigjoe11a View Post
Yes I know all that. I just can't list the related files for the one I picked in the 1st listview.
Thats why I need to know how to return the value from the selected item in the 1st listview. When I have that I can use it to select the related files for the one I selected.

heres the code I can for when then form loads. This puts all the files with a bms ext in the 1st listview.
Code:
 private void MapBase_Load(object sender, EventArgs e)
        {
            textBox2.Text = MLHSetting.Default.PlayableMaps;
            string path = textBox2.Text.TrimEnd();
            DirectoryInfo dr = new DirectoryInfo(@path);
 
            List<string> files = new List<string>();
            int totalfiles = 1;
            foreach (FileInfo file in dr.GetFiles("*.bms"))
            {
                //add each file to the Generic list
                files.Add(file.Name);
                m_Playable.Items.Add(file.Name);
                totalfiles += 1;
            }
            label2.Text = "Total Files : " + totalfiles.ToString();
 
        }
Then when I select the file name from the list above. The code below will select and add the related files to the 2nd listview
Code:
 private void m_Playable_SelectedIndexChanged(object sender, EventArgs e)
        {
            //string fname = GetFileNameWithoutExtension(m_Playable.SelectedItems);
            //string fname = m_Playable.SelectedItems(m_Playable.SelectedItems);
            ListView.SelectedListViewItemCollection items = m_Playable.SelectedItems;
 
            label3.Show();
            label3.Text = "Selected File Name : " + items + ".bms";
 
            m_ListRealted.Items.Clear();
 
            string path = textBox2.Text;
            DirectoryInfo dr = new DirectoryInfo(@path);
 
            List<string> relatedfiles = new List<string>();
 
            foreach (FileInfo related in dr.GetFiles(items + ".*"))
            {
 
                relatedfiles.Add(related.Name.ToString());
 
            }
Does that help
What would help is if you set a breakpoint on line highlighted line and look at the values in a debugger. When you do that, is it the expected value(s)? Does it makes sense to use this value/these values in a GetFiles(...) method call?

If you aren't using the debugger or don't know how please let us know so we can help you. Guessing by punching in values isn't going to get you far (and will be frustrating to boot).