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.
Then when I select the file name from the list above. The code below will select and add the related files to the 2nd listviewCode: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(); }
Does that helpCode: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()); }




Reply With Quote