Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

List not working

$
0
0

Trying to figure out why this isn't working, the list is to retrieve photos using the combobox item (which lists local HDDs root address as items) when selected that item it is converted into a string and supposed to be used as a path for theGetFiles, I run into a get or set accessor expected error

public List<Photos> LoadImages ///List Retrieves and Loads Photos
    {
if (HDDSelectionBox.SelectedItem != null)
{
    string path = HDDSelectionBox.SelectedItem.ToString(); //ComboBox SelectedItem Converted To String As Path
    foreach (string filename in Directory.GetFiles(path, "*.jpg")) 
    {
        try
        {
            Image.Add( //Add To List
                new Photos(
                    new BitmapImage(
                        new Uri(filename)),
                        System.IO.Path.GetFileNameWithoutExtension(filename)));
        }
        catch { } //Skips Any Image That Isn't Image/Cant Be Loaded
    }
    return Image;
}
}


Viewing all articles
Browse latest Browse all 31927

Trending Articles